views:

22

answers:

1

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}

in nklist.txt :

1 David
2 Mark
3 Simon

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.

A: 

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.

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".

Tim Stone
Thanks for the answer,,so what you mean is i have to move the txt file somewhere in the server folder?my root path is /home/mobilevi/public_htmlWhere do you recommend should i put my map file?
Wasim
No, it's not an issue with your txt file, it's just that you can't use `RewriteMap` in `.htaccess` because it's not allowed. You have to set it in a server configuration, which you probably cannot do unless you fully control the server. Are you on a shared host, or do you control the server yourself?
Tim Stone
sorry i miss understood you answer, got the point now, i am on share host, but i also have my own server.thanks for the answer though
Wasim