问题
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