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 use the following configuration:

RewriteEngine On
RewriteMap url-rewrite prg:/usr/bin/url-rewrite
RewriteRule ^(.*)$ ${url-rewrite:%{HTTP_HOST}$1} [P]

But sometimes the rewritten URLs get mixed up: - - [30/Jun/2011:15:12:37 +0300]   
[localhost...] [...] (5) map lookup OK:
map=url-rewrite key=localhost/1.gif ->

The url-rewrite script only adds the path segment but doesn't change the name of the file. I expected val= This causes the user to actually get the wrong image file.

Note: If you want to get detailed debug log like the above (with performance implications) use:

RewriteLog /path/to/file.log
RewriteLogLevel 9
share|improve this question
up vote 2 down vote accepted

Seems the url-rewrite script is getting wrong, you should post this script code.

But before that check that you've set the RewriteLock Directive, when using a prg: apache needs a synchronisation lock, not to mix results.

share|improve this answer
Thanks. It was definitely the missing RewriteLock directive. – Yonatan Broza Jul 1 '11 at 18:03

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.