Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 500 when I have RewriteMap in .htaccess

I have a map file in this format

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

I have the following .htaccess script. I'm getting a 500 Internal Server Error when the page in question is hit.

RewriteEngine On
RewriteBase /
Options +FollowSymLinks

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

When I pass the following URL I wish for it to be rewritten as follows.

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

should be rewritten like this

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

Any thoughts?

like image 572
Vibration Of Life Avatar asked Oct 31 '11 19:10

Vibration Of Life


People also ask

What causes 500 errors PHP?

PHP Coding Timing Out If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules.

How do I trigger a 500 error?

htaccess, you can simply trigger a 500 directly: RewriteRule ^ - [R=500] . (In fact, any invalid syntax would do the job, eg crash ). You don't need the separate folder, you could make the error conditional in your main .


1 Answers

You can't have RewriteMap in an .htaccess file:

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

Only usable in server config (like httpd.conf) and your virtual host conf files.

like image 169
Jon Lin Avatar answered Oct 28 '22 17:10

Jon Lin