I'm using mod_rewrite's RewriteMap directive to process URLs. My RewriteMap program is a PHP script and everything is running fine. I'm able to map friendly URLs to PHP program + ID. Anyway, what I want to do is return a 301 redirect for certain URLs. For example, if someone puts in the URL:
http://www.example.com/directory1
Then I want my RewriteMap program to send a 301 redirect to
http://www.example.com/directory1/
(trailing slash)
Which will then go into my program again to be mapped onto a PHP script. I tried adding [R=301] at the end of my statement, but this just hangs the request. Here's the basic logic of my script:
if ($input_url == "/directory1") { echo "/directory1/ [R=301]\n"; // this doesn't work... just hangs } else if ($input_url == "/directory1/") { echo "/myprogram.php?id=1\n"; }
Any ideas?