【发布时间】:2015-09-30 04:15:07
【问题描述】:
http://localhost/codeigniter/index.php/user/main_page
如何从这个 url 中删除 index.php ?
【问题讨论】:
标签: .htaccess codeigniter
http://localhost/codeigniter/index.php/user/main_page
如何从这个 url 中删除 index.php ?
【问题讨论】:
标签: .htaccess codeigniter
【讨论】:
答案在复制此问题的帖子中。
肖恩·维埃拉的回答:
如果您使用的是 Apache,请在您的根网站中放置一个 .htaccess 文件 包含以下内容的目录:
RewriteEngine on RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L]另一个不错的版本在这里:
【讨论】:
试试这个:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
替换:
$config['index_page'] = "index.php"
to
$config['index_page'] = ""
if it still not work try to replace:
$config['uri_protocol'] = "AUTO"
//replace with the below code
$config['uri_protocol'] = "REQUEST_URI"
更多详情:http://w3code.in/2015/09/how-to-remove-index-php-file-from-codeigniter-url/查看此
【讨论】: