CodeIgniter Forums
why all request use Controller Welcome? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: why all request use Controller Welcome? (/showthread.php?tid=35170)



why all request use Controller Welcome? - El Forum - 10-21-2010

[eluser]Unknown[/eluser]
I have upload my website to linux server, it is use cpanel
i have use follow:

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

and

$config['index_page'] = "";

but when i request a url such as : /aaa/bbb
it also use welcome Controller, no use Controller aaa
but if I request /index.php/aaa/bbb
it is right

and it is right at my computer(windows with apache)

why?


why all request use Controller Welcome? - El Forum - 10-21-2010

[eluser]WanWizard[/eluser]
Your rewrite rule removes all URI segments by moving them after the question mark (where they are useless). So every request is rewritten to request index.php without segments, which loads the default controller.

Change the question mark into a slash, and you'll be fine.


why all request use Controller Welcome? - El Forum - 10-21-2010

[eluser]pbreit[/eluser]
Here's mod_rewrite code from CodeIgniter documentation:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]