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

#1
[eluser]Artemis Mendrinos[/eluser]
Hello,

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?

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

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

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

#4
[eluser]TheFuzzy0ne[/eluser]
How about this:
Code:
RewriteRule ^(.*)$ index.php?/$1 [L]

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

#5
[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:
http://ellislab.com/codeigniter/user-gui.../urls.html

Thanks a lot for your help..

#6
[eluser]TheFuzzy0ne[/eluser]
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.

#7
[eluser]drewbee[/eluser]
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.

http://ellislab.com/codeigniter/user-gui...oting.html

This was something I ran across when I switched hosts.

#8
[eluser]TheFuzzy0ne[/eluser]
@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.