apache.htaccessurl-rewritingrewritemap

Error 500 when I have RewriteMap in .htaccess


I have a map file in this format

233 Alabama/Phenix-City/Ridgebrook
237 Alabama/Ft.-Mitchell/Riverside-Estates

I have the following .htaccess script. I'm getting a 500 Internal Server Error when the page in question is hit.

RewriteEngine On
RewriteBase /
Options +FollowSymLinks

RewriteMap examplemap txt:/var/www/html/site.com/key_pair.txt
RewriteRule community.php?(.*) ${examplemap:$1} [R]

When I pass the following URL I wish for it to be rewritten as follows.

http://example.com/community.php?comm_id=233    

should be rewritten like this

http://example.com/Alabama/Phenix-City/Ridgebrook

Any thoughts?


Solution

  • You can't have RewriteMap in an .htaccess file:

    http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritemap

    Only usable in server config (like httpd.conf) and your virtual host conf files.