how to remove index.php from codeigniter URL [duplicate]

喜夏-厌秋 提交于 2020-01-06 05:38:19

问题


Possible Duplicate:
how to remove index.php from url in codeigniter ?

I want to remove index.php from the codeigniter url. I have created .htaccess file and placed the following code on it (as found on the CodeIgniter website. But i can not access anything on the localhost. I get the error "Not Found", if i place the code in the .htaccessfile.

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

My url looks like localhost/test/project/index.php


回答1:


Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)$ index.php



回答2:


did you remove index.php like so

$config['index_page'] = '';

from the config file in your config folder from application ?




回答3:


If you have tried everything in the user guide and had no luck it may be an issue with your local setup. If you are on a Mac there may be an issue with your Apache setup. I would check /etc/apache2/[username].conf and make sure that you have AllowOverride set to All.



来源:https://stackoverflow.com/questions/6201409/how-to-remove-index-php-from-codeigniter-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!