如何从codeigniter路径中删除index.php

时间:2017-04-03 15:04:59

标签: php apache .htaccess codeigniter mod-rewrite

这是我的wamp / www / .htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /project-name/index.php/$1 [L]

# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
**strong text**

但显示错误 在此服务器上找不到请求的URL / ci / public / signup。

Apache / 2.4.9(Win64)PHP / 5.5.12服务器:: 1端口80 问题是什么..我也从config.php文件中删除了index.php ..

2 个答案:

答案 0 :(得分:1)

尝试以下

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

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

$config['index_page'] = ""

在某些情况下,uri_protocol的默认设置无法正常运行。只需替换

$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] 

答案 1 :(得分:0)

<强> htaccess的

RewriteEngine on
RewriteRule ^(.*)$ ./index.php/$1 [L]
RewriteCond $1 !^(index\.php|resources|robots\.txt)