Jump to content

CI & .htaccess problem


Grandioso

Recommended Posts

I have the same exact .htaccess file with the same exact application on a remote server and on localhost. One works without problems, one gives a "500 internal server error".

 

What it should do is redirect any page ("domain.xx/link/to/page") to "domain.xx/index.php/link/to/page" (CodeIgniter does it this way). The problem is that it redirects everything, so even my css file gets redirected.

So I tried to get around this with success on localhost.

Here's my .htaccess :

 

RewriteEngine on
RewriteCond $1 !^(index\.php|design)
RewriteRule ^(.*)$ index.php/$1 [L]

 

Any idea how could I have the same functionality, with a code that works on the remote server or what can cause the problem ?

Link to comment
https://forums.phpfreaks.com/topic/218529-ci-htaccess-problem/
Share on other sites

to stop it doing mod-rewrite on css, js and images files you need to add the following 2 rewrite conditions to your htaccess file.

 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

 

So your new htaccess will look like this...

 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|design)
RewriteRule ^(.*)$ index.php/$1 [L]

 

However, to be honest, I would just use the htaccess given here... http://codeigniter.com/wiki/mod_rewrite/

Link to comment
https://forums.phpfreaks.com/topic/218529-ci-htaccess-problem/#findComment-1136043
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.