url not working with browser other than chrome, ht

2019-08-30 00:01发布

问题:

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

I have written this .htaccess file when I access localhost/myProject/home in Chrome this works fine but in other browsers it show page not found error

回答1:

Most likely you need Options +FollowSymLinks. And for more htaccess for codeigniter click on link and download zip At David Connelly's Website. They have about 5 different ones that you could try in zip, no doubt one of them will work. http://www.insiderclub.org/downloads

The one I use below works fine in all browsers for codeigniter. Make sure when you use this or any other htaccess, that you place your domain in base url at config/config.php and then remove the index.php from config/config.php

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