CodeIgniter Forums
Why is it so hard to remove index.php? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Why is it so hard to remove index.php? (/showthread.php?tid=859)



Why is it so hard to remove index.php? - behnampmdg3 - 01-23-2015

Hi;

There are really 100s of posts on this! I still can't get it to work! I have tried these but non work!

Help please.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Code:
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]



RE: Why is it so hard to remove index.php? - ChicagoPhil - 01-23-2015

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*) index.php [L]


RE: Why is it so hard to remove index.php? - ChicagoPhil - 01-23-2015

I'm not sure what's going on but I replied to this topic a while ago. I'll try once more.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*) index.php [L]


RE: Why is it so hard to remove index.php? - dmyers - 01-23-2015

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]

I use pretty much use what ChicagoPhil uses except I add the RewriteBase / since I use VirtualHost's
The index.php line is a bit different to?

Give it a try if the other does work for your host.


RE: Why is it so hard to remove index.php? - ChicagoPhil - 01-23-2015

Also make sure to set your $config['base_url'] and take index.php out of the $config['index_page'] in application/config/config.php file.


RE: Why is it so hard to remove index.php? - behnampmdg3 - 01-23-2015

Now this is working Smile
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Thanks guys