CodeIgniter Forums
Removing index.php from URLs.... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Removing index.php from URLs.... (/thread-2373.html)



Removing index.php from URLs.... - El Forum - 08-01-2007

[eluser]Lee Mc[/eluser]
Hi,

I know this really, really shouldn't be that difficult, but it's managed to ruin my entire day. I give up, I need help!

I've set up a site using CI (latest build) and whilst i'm at the stage where I can browse the root of the CI site without "index.php", I can't access any of my other controllers without getting a 404. The only way I can get the pages to load is by using "index.php"...

I've set my "index page" in config.php as blank.
Mod_rewrite is set up on my server.
I took the sample .htaccess code from this site, which is as follows:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

For some reason, when I add the above .htaccess to the root of my CI site, I then get a 404 on my home page too, unless I specify "index.php". I realise this is probably me being ill-educated about .htaccess files, and i'm clearly missing something (perhaps a few brain cells). Any ideas would be appreciated...

Oh, and here's the URL of the CI version of my site: http://www.november10th.co.uk/codeigniter/


Thanks...


Removing index.php from URLs.... - El Forum - 08-01-2007

[eluser]sukar[/eluser]
i don't know about .htaccess but check this one: http://www.ellislab.com/codeigniter/user-guide/installation/troubleshooting.html
it says you should change $config['index_page'] = "index.php"; to this
$config['index_page'] = "index.php?"; the difference is the addition of “?”.


Removing index.php from URLs.... - El Forum - 08-01-2007

[eluser]Lee Mc[/eluser]
Thanks for the suggestion. I gave it a try but no joy...


Removing index.php from URLs.... - El Forum - 08-01-2007

[eluser]BravoAlpha[/eluser]
Mine looks like this:
Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /~bravoalpha/ci/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>



Removing index.php from URLs.... - El Forum - 08-02-2007

[eluser]sukar[/eluser]
try this one: http://codeigniter.com/wiki/mod_rewrite/


Removing index.php from URLs.... - El Forum - 08-02-2007

[eluser]Lee Mc[/eluser]
Yeah, got there in the end, thanks!

I think the fact that I didn't really understand how mod_rewrite was working was the main problem...