RewriteMap does not work in mod-rewrite

I am trying to make a simple comparison with the RewriteMap directive in my htaccess, but for some reason I get a 500 error every time. my syntax is .. Options + FollowSymLinks

RewriteEngine on RewriteBase / RewriteMap name2id txt:nklist.txt RewriteRule ^/name/(.*) /name_list_view.php?kid=${name2id:$1|NOTFOUND} 

in nklist.txt:

 1 David 2 Mark 3 Simon 

The nklist.txt file is located in the root of my site, in the same place where htaccess is located. As far as my debugging tells me, htaccess cannot find the nklist.txt file, but any help would be appreciated.

+4
source share
1 answer

From your description, you are trying to define a RewriteMap in context for each directory through your .htaccess file, but this is not valid. RewriteMap can only be defined in the context for each server, either in the configuration of the primary server or in the virtual server section.

When you make requests to the server, and the .htaccess file .htaccess parsed, it encounters the RewriteMap directive and gives a warning, which causes an error 500. Probably, you will see an entry in your error_log saying that "RewriteMap is not allowed here."

+7
source

Source: https://habr.com/ru/post/1316496/


All Articles