如何在服务器的codeigniter中删除“index.php”

时间:2013-08-31 12:31:27

标签: php codeigniter-2

在Codeigniter中从我的网址中删除index.php时遇到问题。

我的直播网址:“http://ec2-174-129-44-226.compute-1.amazonaws.com”实时服务器中的问题

还有本地的问题

我尝试使用以下代码。

上的RewriteEngine

RewriteCond $ 1!^(index.php | resources | robots.txt)

RewriteCond%{REQUEST_FILENAME}!-f

RewriteCond%{REQUEST_FILENAME}!-d`

RewriteRule ^(。*)$ index.php / $ 1 [L,QSA]

但它会在本地wamp服务器中触发错误

“内部服务器错误

服务器遇到内部错误或配置错误,无法完成您的请求。

请与服务器管理员admin @ localhost联系,告知他们错误发生的时间,以及可能导致错误的任何操作。

服务器错误日志中可能提供了有关此错误的更多信息。“

请..... help..me ...谢谢...

2 个答案:

答案 0 :(得分:1)

试一试。

打开config.php并执行以下替换

$config['index_page'] = "index.php"
to
$config['index_page'] = ""

在某些情况下,uri_protocol的默认设置无法正常运行。 只需更换     $ config ['uri_protocol'] =“自动”     通过     $ config ['uri_protocol'] =“REQUEST_URI”

htaccess的

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

答案 1 :(得分:1)

打开config.php并执行以下替换

$config['index_page'] = "index.php" 

替换为

$config['index_page'] = ""

$config['uri_protocol'] = "AUTO" 

替换为

$config['uri_protocol'] = "REQUEST_URI"

htaccess的

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
相关问题