apache - 当我在 .htaccess 中有 RewriteMap 时出现错误 500

标签 apache .htaccess url-rewriting rewritemap

我有一个这种格式的 map 文件

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

我有以下 .htaccess 脚本。当访问相关页面时,我收到 500 内部服务器错误。

RewriteEngine On
RewriteBase /
Options +FollowSymLinks

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

当我传递以下 URL 时,我希望将其重写如下。

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

应该这样重写

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

有什么想法吗?

最佳答案

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

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

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

关于apache - 当我在 .htaccess 中有 RewriteMap 时出现错误 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7958492/

相关文章:

php - 无法使用 PHP 上传文件

php - httpd libphp5.so ldap错误

Apache ssl.conf SSLCipherSuite 语法 : How to translate cypher suite names in underscore format to Apache?

php - 如何使用 htaccess URL php 变量进行 301 重定向

php - Yii 2.0 从 URL 中隐藏/basic/web 以及 index.php

linux - 配置 Apache Tomcat 以运行 PHP

php - 谷歌索引同一页面的两个 URL - 有和没有 index.php

apache - CodeIgniter htaccess 子文件夹问题

php - 在 PHP 中路由 URL

redirect - 用于查询字符串的Nginx位置正则表达式