Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
...fail!

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
  etc...
  <Directory /var/www/site>
  AllowOverride all
  Options Indexes FollowSymLinks MultiViews
  Order allow,deny
  Allow from 127.0.0.1
  RewriteEngine On
  RewriteMap map txt:/var/www/site/map.txt
  RewriteRule /path/[^/]+/([^/]+) ${map:$1} 
  etc...
share|improve this question

1 Answer 1

up vote 2 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

 
discard

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.