Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter, routing is not functioning on production server

I have 3 servers, a localhost apache server, a testing remote server and the production live server.

I have the same installation of codeigniter and site set-up on all 3 of them and on the localhost and testing servers routing without 'index.php' works 100%. On the Production server however, no matter what the URL says only the homepage (via the default controller) will be shown, it seems all routing rules are being ignored except the default one.

If however index.php is added in the URL then it will work like it supposed to.

For instance if the URL on the production site is: 'www.mysite.com/information' then the content that loads is form the default controller.

But when the URL on the production site is: 'www.mysite.com/index.php/information' then the content that loads is from the 'information' controller.

This is the contents of my htacess file: http://pastebin.com/cDaZVJ8A

This is my routes config file: http://pastebin.com/7Ewc2bwN

My $config['index_page'] is set to nothing.

I really dont know why its not working, the same setup on all servers in term of codeigniter itself, and mod_rewrite IS working on the production server.

I don't know what to do, how can I find-out what's wrong?

like image 306
Nicekiwi Avatar asked Dec 05 '12 07:12

Nicekiwi


2 Answers

This is quite a common problem that often occurs when people move a codeigniter install from one environment to another. I have no idea why it occurs, could be a difference in server OS or apache settings, but the solution is often to add a question mark ? to the RewriteRule for the index.php in your .htaccess file.

Old:

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

New:

RewriteRule ^(.*)$ index.php?/$1 [L]
like image 163
Jeemusu Avatar answered Sep 22 '22 14:09

Jeemusu


Check your Apache virtual host configuration and verify that you have AllowOverride All in your directory definition.

like image 29
m4t1t0 Avatar answered Sep 21 '22 14:09

m4t1t0