![]() |
htaccess for removing index.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9) +--- Thread: htaccess for removing index.php (/showthread.php?tid=61341) |
htaccess for removing index.php - sackbut - 04-09-2015 This is not a question - it's a tip. There are many folks out there puzzled because the htaccess file supplied at the root of CI does not remove index.php from the URL. They've checked that mod_rewrite is on and that Allow overrides is on for their root, but still no joy. Lots of conflicting advice on Stackoverflow and the like. I tried it on three different Apache setups: at home it worked, at hosting provider A it worked, but at hosting provider B it did not. Fortunately hosting provider B had a very smart support person who told me the fix. The re-write rule supplied by CI is this : RewriteRule ^(.*)$ index.php/$1 [L] The one that works on all Apache servers is this: RewriteRule ^(.*)$ index.php?/$1 [L] Notice the ? at the end of index.php It's backwards compatible - the new rule works on all the machines I tested it on. So I'd like to suggest that the CI folks change the documentation for "Removing the index.php file" Hope this will help someone KT RE: htaccess for removing index.php - gadelat - 04-09-2015 Can you tell under what condition htaccess content specified in documentation doesn't work? (Apache server version, configuration...) RE: htaccess for removing index.php - InsiteFX - 04-10-2015 Has to do with running Apache fast CGI PHP Code: <IfModule mod_rewrite.c> RE: htaccess for removing index.php - alkarim - 04-16-2015 thanks for the tip. was searching for the stuff a whole week. ![]() RE: htaccess for removing index.php - sackbut - 04-19-2015 (04-10-2015, 03:38 AM)InsiteFX Wrote: Has to do with running Apache fast CGI Yep - that's what the support guy told me. I don't think I would have figured that out on my own ! And thanks for the more detailed reply - I'm sure that will be useful for many folks KT |