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

This seems like a very simple question.

I tried putting a RewriteMap directive in an .htaccess file but the logs showed an alert:

RewriteMap not allowed here

Then I tried putting it in the VirtualHost declaration in the apache2/sites-available file, but reloading apache gives me:

RewriteMap not allowed here!

In both cases with RewriteEngine on.

Is this referring to the location of the actual map on the file system, or the RewriteMap directive?

Just in case it helps:

<VirtualHost *:80>
  ServerName localhost
  <Directory /var/www/site>
  AllowOverride all
  Options Indexes FollowSymLinks MultiViews
  Order allow,deny
  Allow from
  RewriteEngine On
  RewriteMap map txt:/var/www/site/map.txt
  RewriteRule /path/[^/]+/([^/]+) ${map:$1} 
share|improve this question
up vote 4 down vote accepted

According to the official documentation it's only allowed in the scope (Context: in the infobox) of server config, virtual host. Place it outside the directory directive and it will work.

share|improve this answer
Thanks for the very quick reply! – lazysoundsystem Aug 13 '10 at 14:20

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.