CodeIgniter Forums
CodeIgniter URLs - 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: CodeIgniter URLs (/showthread.php?tid=15706)



CodeIgniter URLs - El Forum - 02-12-2009

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


CodeIgniter URLs - El Forum - 02-12-2009

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

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



CodeIgniter URLs - El Forum - 02-12-2009

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


CodeIgniter URLs - El Forum - 02-12-2009

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

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



CodeIgniter URLs - El Forum - 02-12-2009

[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-guide/general/urls.html

Thanks a lot for your help..


CodeIgniter URLs - El Forum - 02-12-2009

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


CodeIgniter URLs - El Forum - 02-12-2009

[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-guide/installation/troubleshooting.html

This was something I ran across when I switched hosts.


CodeIgniter URLs - El Forum - 02-12-2009

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