【发布时间】:2014-01-09 17:25:10
【问题描述】:
我在我的文档根目录/var/www/html/ 中创建了一个 .htaccess 文件来重写 Codeigniter 的 URL 以从所有页面的 URL 中删除“index.php”。
例如更改网址
http://myhost/index.php/controller/function
到
http://myhost/controller/function`
这是我的`/var/www/html/.htaccess 的代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我从谷歌上得到了很多关于启用 mod-rewrite 模块的建议,但我可以在我的 httpd.conf 中看到它已经启用。
LoadModule rewrite_module modules/mod_rewrite.so
这在我在 Debian 7 (Apache/2.4.4) 上运行的本地系统上完美运行。
任何帮助将不胜感激。 :)
【问题讨论】:
标签: linux apache .htaccess codeigniter mod-rewrite