CodeIgniter Forums
Stupid Simple .htaccess problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Stupid Simple .htaccess problem (/showthread.php?tid=13006)



Stupid Simple .htaccess problem - El Forum - 11-07-2008

[eluser]johnmchilton[/eluser]
Hi there, I have a CI install at http://www.example.com/ci/

So, pages look like http://www.example.com/ci/index.php/controller/function

I am wondering what to put in the .htaccess file to remove the index.php from this. Does anybody know? Thanks.


Stupid Simple .htaccess problem - El Forum - 11-07-2008

[eluser]jamie young[/eluser]
Follow the steps listed at http://codeigniter.com/wiki/mod_rewrite/

That should get it going for you.


Stupid Simple .htaccess problem - El Forum - 11-07-2008

[eluser]johnmchilton[/eluser]
The problem is that I know how to do steps 2-5, but I don't know how to get the desired effect with a .htaccess file, and all the tutorials online seem to be written for people who already know how to do it. Can somebody point me in the right direction?


Stupid Simple .htaccess problem - El Forum - 11-16-2008

[eluser]stdio[/eluser]
I am also interested in it. Any help for us?


Stupid Simple .htaccess problem - El Forum - 11-16-2008

[eluser]inet411[/eluser]
Here is what I use:

Code:
RewriteEngine on

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

RewriteRule ^(.*)$ index.php?$1 [L,QSA]

Works for me. Hope it helps you.


Stupid Simple .htaccess problem - El Forum - 11-16-2008

[eluser]stdio[/eluser]
Thank you inet! This is what I needed. Works perfectly! Smile


Stupid Simple .htaccess problem - El Forum - 11-16-2008

[eluser]johnmchilton[/eluser]
I ended up editing my apache configuration to add a <Directory /var/www/ci/> with:

RewriteCond $1 !^(index.php|media)
RewriteRule ^(.*)$ index.php/$1 [L]

Three cheers for workarounds, am I right?