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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.