RewriteMap指令不工作的mod-rewrite [英] RewriteMap not working in mod-rewrite
问题描述
我一直在努力做简单的马平与RewriteMap指令指令在我的htaccess的,但由于某些原因,我收到错误500每次。我的语法是.. 选择了FollowSymLinks +
I have been trying to do simple maping with RewriteMap directive in my htaccess, but for some reason i am getting error 500 everytime. my syntax is .. Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteMap name2id txt:nklist.txt
RewriteRule ^/name/(.*) /name_list_view.php?kid=${name2id:$1|NOTFOUND}
在nklist.txt:
in nklist.txt :
1 David
2 Mark
3 Simon
在nklist.txt文件是在我的网站上,同样的地方,htaccess是根。至于我调试告诉我,htaccess是不是能够找到nklist.txt文件,但任何帮助将感谢。
the nklist.txt file is on the root of my website , same place where the htaccess is . As far as my debugging tells me that htaccess is not able to find the nklist.txt file, but any help would be thankful.
推荐答案
从你的描述,你试图通过定义一个 RewriteMap指令
在每个目录范围内的的.htaccess
文件,但这是不允许的。该 RewriteMap指令
只能是在单个服务器中定义的,无论是在主服务器配置或虚拟服务器的部分。
From your description, you're attempting to define a RewriteMap
in a per-directory context via your .htaccess
file, but this isn't allowed. The RewriteMap
can only be defined in a per-server context, either in the main server configuration or in a virtual server section.
当你发出请求到服务器和的.htaccess
文件进行分析,当遇到 RewriteMap指令
指令和发出警报,导致被抛出一个500错误。你可能会看到一个条目的的error_log
各国RewriteMap指令不允许在这里。
When you make requests to the server and the .htaccess
file is parsed, it encounters the RewriteMap
directive and issues an alert, which results in an 500 error being thrown. You'll likely see an entry in your error_log
that states "RewriteMap not allowed here".
这篇关于RewriteMap指令不工作的mod-rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!