Welcome Guest, Not a member yet? Register   Sign In
Discuss: Extremely simple .htaccess to remove index.php
#1

[eluser]Aken[/eluser]
I discovered this on a local developer's blog this evening - a stupid easy alternative method to typical .htaccess rewrite rules to remove the index.php.

Instead of all the typical RewriteCond rules, this is all you need in .htaccess:
Code:
FallbackResource /index.php
(Note that you will likely need more in your .htaccess for other things like Apache settings, caching, etc., but this is all you need for basic index.php removal.)

I tested it using a basic CI install on my local MAMP install (as well as a Laravel install for good measure) and it seemed to work great. I did notice my browser thinking for longer than it should when loading the base domain without index.php. I added a DirectoryIndex definition and it went away. That could be my MAMP install or a fault of this method - I'm not sure.

Anyone more familiar with .htaccess or Apache have any thoughts? I'm going to continue testing it in different environments to see if I can make it fault in some way. But it seems promising. Would certainly prevent a lot of redundant questions, and provide an alternative to the poorly-written htaccess code that is often recommended.




Theme © iAndrew 2016 - Forum software by © MyBB