CodeIgniter Forums

Full Version: Removing index.php from URLs....
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Lee Mc[/eluser]

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:


El Forum

i don't know about .htaccess but check this one:
it says you should change $config['index_page'] = "index.php"; to this
$config['index_page'] = "index.php?"; the difference is the addition of “?”.

El Forum

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

El Forum

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

El Forum

try this one:

El Forum

[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...