• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter URLs

[eluser]Artemis Mendrinos[/eluser]

I have created the .htaccess file:

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

and I have updated my application/config/config.php

the value $config['index_page'] = "";

but my application is only able to load the default controller, when I request another controller from the url then I get back the default controller again.

Any ideas?

Try changing the bottom line from:
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteRule ^(.*)$ index.php/$1 [L]

[eluser]Artemis Mendrinos[/eluser]
nope, still the same behavour...

How about this:
RewriteRule ^(.*)$ index.php?/$1 [L]

or this:
RewriteRule ^(.*)$ index.php?$1 [L]

[eluser]Artemis Mendrinos[/eluser]
hey!, the first one worked just fine!!

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

Its weird, I took my first .htaccess from the official user guide:

Thanks a lot for your help..

I don't understand it either. Sometimes it seems that one thing works for one person, but not another.

I took the mine from the source here - http://codeigniter.com/wiki/mod_rewrite/ - on the wiki.

I'm not sure whether the second and third parts are both needed. I am sure that only one or the other would suffice, especially if you move your system and application directory outside of your Web root, but I am not an expert with htaccess, nor do I claim to be.

This is a configuration problem. See in config.php the option URI Protocol. By default it is set to AUTO, and doesn't work on all hosts. Keep trying all the listed options until your controllers show up properly.


This was something I ran across when I switched hosts.

@drewbee: That had never occurred to me... Top tip, though, thanks for the advice!

@Artemis Mendrinos: I encourage you to try what drewbee suggested with the original .htaccess format.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.