Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had to add a rule to the .htaccess file of existing site, which redirect some old images urls to the new ones. So, directly after the

RewriteEngine On

I added my new rule:

RewriteRule   ^images/photos/(.+)      /media/projects/$1       [L]

Locally and on the dev server - all is fine. But when I deployed it on the live site - it's not working :( ...

Locally I'm on OpenSUSE, the dev server is on Ubuntu Server, and the live server is FreeBSD. I ran phpinfo() and it showed that on the live server (shared hosting) I have mod_rewrite, so I don't know what could the problem be. Tried to add some "Options" to the .htaccess file, tried with flag for redirect in the end of the new rule ... but nothing changed.

All the other rules are working. When I break something in the .htaccess file - it gives me "Internal server error", and if I write "Deny from all" - it gives me "Forbidden" - as it should.

Can you help me? ... Thanks in advance :)

On another forum got some advices and tried:

RewriteRule ^images/photos/(.+) /media/projects/$1 [L]

RewriteRule ^/images/photos/(.+) /media/projects/$1 [L]

RewriteRule ^/?images/photos/(.+) /media/projects/$1 [L]

but none of these worked :( ...

share|improve this question

migrated from Sep 28 '13 at 19:49

This question came from our site for computer enthusiasts and power users.

Well, after some experiments I did - I figured out what the problem was :) ...

The structure of the application is this:

/ - root
      |- application
      |- public
      |       |- css,images, etc ... 
      |       \- .htaccess
      \- .htaccess

So, the virtual hosts - local and on dev - are pointing to the "root", while on the live site the domain appears to point to the "public" folder. And so, when I put the rules on the "public" .htaccess file - then it all worked on the live site. (And what was confusing for me was that when I break the "root" .htaccess file - the live site gives Error 500 ... and that's why I thought the "root" .htaccess file is the one that I should use ...)

share|improve this answer
If you want to mark your problem as solved, mark your answer as the working solution – Oliver Salzburg Sep 26 '13 at 18:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.