Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter Rewrite Rules
#1

[eluser]IanMcQ[/eluser]
Hello,

I am transferring a CodeIgniter application to another server. I am attempting to test the application on the new server at an IP address. I've got my CodeIgniter rewrite rules in an .htaccess.

What's happening is 1.1.1.1/controller/method always renders the default controller (which my case is indexpage.php and the index() instance method.

I tried switching my $config['base_url'] to 'http://1.1.1.1/' (from the domain) to see if that would make a difference, but unfortunately, the default controller always renders.

http://1.1.1.1/index.php/controller/method links do work, though, which is good.

I am just wondering if this would be a server configuration error (something not working as expected on the new server) or if CodeIgniter and rewrite rules don't play friendly with IP address-based sites.

Just don't want to flip the switch to transfer my site and have all my URLs be broken.

Thanks in advanced.
#2

[eluser]Ckirk[/eluser]
Is it definitely a Linux server you're hosting on?

If so can you post your htaccess content here?
#3

[eluser]IanMcQ[/eluser]
Yes, it's definitely a Linux server. Here's what I have:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|index\.html|compare\.php|images|js|css|static|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

ErrorDocument 500 /404
ErrorDocument 404 /404
ErrorDocument 403 /404

UPDATE

I did some more research. Turns out my rewrite problem is a strange cPanel/Apache issue (my old server wasn't running cPanel, so that was the difference for me).

Update config.php and change $config[‘uri_protocol’] = 'PATH_INFO'; to:

Code:
$config[‘uri_protocol’] = 'ORIG_PATH_INFO';
Thread reference:

http://ellislab.com/forums/viewthread/207671/




Theme © iAndrew 2016 - Forum software by © MyBB