当我在.htaccess中有RewriteMap时出错500

Vib*_*ife 5 apache .htaccess url-rewriting rewritemap

我有这种格式的地图文件

233 Alabama/Phenix-City/Ridgebrook
237 Alabama/Ft.-Mitchell/Riverside-Estates
Run Code Online (Sandbox Code Playgroud)

我有以下.htaccess脚本.当遇到有问题的页面时,我收到500内部服务器错误.

RewriteEngine On
RewriteBase /
Options +FollowSymLinks

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

当我传递以下URL时,我希望它被重写如下.

http://example.com/community.php?comm_id=233    
Run Code Online (Sandbox Code Playgroud)

应该像这样重写

http://example.com/Alabama/Phenix-City/Ridgebrook
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

Jon*_*Lin 9

您不能在.htaccess文件中包含RewriteMap:

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

仅在服务器配置(如httpd.conf)和虚拟主机conf文件中可用.