【发布时间】:2015-05-26 03:51:35
【问题描述】:
我是 codeigniter 的新手,我正在尝试从 Codeigniter 的 URL 中删除 index.php,但无法做到这一点。 我在我的 .htaccess 文件中编写了代码-
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我的 Apache mod_rewrite 已启用。
但是当我尝试访问任何控制器而不使用 index.php 时仍然出现 404 错误。
请帮忙。
谢谢。
【问题讨论】:
-
您是否启用了模组重写模块。你已经删除了 config.php 文件中的 index.php
-
是的。我已经在我的问题中提到了这一点,并且我已经删除了 index.php 表单配置文件。
-
我做了上面参考文献中建议的所有事情。但仍然面临同样的问题。
-
有时,这取决于服务器(例如 GoDaddy),您需要在
index.php之后附加问号。 IE。RewriteRule ^(.*)$ /index.php?/$1 [L]。也google for far in space codeigniter htaccess 并尝试使用提供的代码。
标签: php apache .htaccess codeigniter mod-rewrite