CodeIgniter - Getting rid of the index.php in different circumstances
I have my CodeIgniter install one path back from the public_html directory so its not in the root of my web folder.
Can someone suggest .htaccess code that will get rid of the index.php in the URL based on this?
I have tried a few in the past and they havent worked, im quite stumped.
Cheers,
I have tried the fo开发者_如何学Gollowing code
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Have you put the index.php one folder back from public_html as well?
I would suggest not doing so, there should be no harm in making the index.php public, but well worth hiding the rest.
Put the index.php back under public_html and modify it like so:
Line 56:
$system_path = '../system';
Line 72:
$application_folder = '../application';
Of course if you have them in another folder then change the path accordingly.
EDIT:
Sorry I should note that afterwards your htaccess should look like this:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
try adding
RewriteBase /public_html/
above the first RewriteCond
.
but I'm not an .haccess wizard by any means.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
精彩评论