隐藏index.php server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_…
在nginx环境下CI框架默认URL规则访问不了,出现500错误,如: http://blog.php230.com/index.php/keywords 今天在服务器配置CI框架环境时,去除URL中的index.php,出现了默认URL规则访问不了的情况,只能通过参数方式访问: http://blog.php230.com/index.php?c=keywords 配置: location /{ if (-f $request_filename) { expires max; break; }…
使用情境:我想输入www.abc.com/a/1后,实际上是跳转到www.abc.com/index.php/a/1 配置Nginx.conf在你的虚拟主机下添加: location / {      if (!-e $request_filename){           rewrite ^/(.*)$ /index.php/$1 last;      } } 如果你的项目入口文件在一个子目录内,则: location /目录/ {      if (!-e $request_filenam…
首先,你要清楚自己的 Web 服务器是 Apache,支持 mod_rewrite 查找httpd.conf中是否开启了mod_rewrite.so 然后,在 CI 根目录下新建立一个配置文件,命名为: .htaccess在里面这样写: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ ./index.php/$1 [L] 就可以去掉 index.php 了.要注意 ./ind…
一.修改 nginx.conf文件,添加如下代码: if ($request_uri ~ (.+?\.php)(|/.+)$ ){ break; } if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } 二.修改配置文件: define('WITH_REWRITE',true); 重启nginx 补充说明 if ($request_uri ~ (.+?\.php)(|/.*)$ ){                b…
我的环境是apache+ubuntu 1,先确认你有没mod_rewrite.so模块 /usr/lib/apache2/modules/mod_rewrite.so 然后在httpd.conf最后一行加上(我不加也行,自己都奇怪) LoadModule rewrite_module modules/mod_rewrite.so 重启/etc/init.d/apache2 restart 2,将/etc/apache2/sites-enabled/000-default中的 AllowOverr…
去掉 URL 中的 index.php 通常的URL里面含有index.php,为了达到更好的SEO效果可能需要去掉URL里面的index.php ,通过URL重写的方式可以达到这种效果,通常需要服务器开启URL_REWRITE模块才能支持. 例如原来的 URL 为: http://127.0.0.1/index.php/Index/insert 去掉 index.php 之后变为: http://127.0.0.1/Index/insert 第一步:更改Apache的httpd.conf 配置…
本篇继续一下Elasticsearch日常使用的技巧翻译. 在Elasticsearch有很多的api支持在body中指定_index等信息,比如mget或者msearch以及bulk. 默认的情况下,body中的index会覆盖掉url中的index参数.比如: $ curl localhost:9200/test/_mget?pretty -d '{"docs":[{"_index":"test1","_id":1},{&…
最近公司新上的网站被seo指出要修改url,去掉url中产品id.由于我们用的是zencart框架,装了 Ultimate SEO URLs 插件,所以在网上应该有这方面的资料,本文主要参考资料: 原网址:http://leezhxing.blog.51cto.com/6634351/1282790 原文只介绍了修改产品页,我在修改过程中一并把分类页也进行了修改,下面为原文修改产品页内容,其中有些错误用红色字体更正. 以前用Ultimate SEO URLs模块 产品地址是这样的 http://…
如果你刚接触CI不久又或者刚刚研读CI的使用手册的话,关于如何有效删除URL中index.php以使URL看起来更友好美观的问题,可能是你面对的第一个较为复杂的问题!本贴不是原创,而是一个各种意见的综合!但本帖提出的解决方案可以有效解决Apache和IIS两种环境下的配置问题,同时也可以有效,避免部分虚拟LINUX虚拟主机上可能出现的no input file specified错误!如果你还在为index.php的问题而苦苦寻觅解决方案,或许这里会是你的最后一站! 官方解决方案 默认情况下,i…