Forum Moderators: phranque
I had expected the above line to redirect to:
/anime/index.php?cmd=_anime-by-title&id=<#ID#>
Unless I comment out the "?" in the url param, I get a Forbidden Error, but when I comment out the "?" it redirects to:
/anime/index.php//?cmd=_anime-by-title&id=<#ID#>
Any ideas on how I can get the expected results using RedirectMatch
Welcome to WebmasterWorld [webmasterworld.com]!
Well, you've found a nasty problem...
It seems that "&" has some special meaning when used in RedirectMatch substitution strings -- It is apparently a back-reference to the entire requested URI.
The only way I was able to get your Redirect to work properly was to use some character other than "&" to delimit the script calling parameters - In this case, I used "+".
RedirectMatch ^/anime/anime-by-title/(.*)\.html$ http://www.example.com/anime/index.php?cmd=_anime-by-title+id=$1
If you can adapt your script to accept some character other than "&" as a delimiter, the above should work. Otherwise, you may have to use mod_rewrite instead of mod_alias.
Jim
[edited by: jdMorgan at 2:06 pm (utc) on Nov. 12, 2003]
If I include a ?, the returned URL is (%-encoded) so i'll get something like www.domain.com/page.php%3ffoo=bar which causes a 403 Forbidden. I tried to comment out the ? character, but the comment gets commented, producing: www.domain.com/page.php%5c%3ffoo=bar, where %5c%3f = \\?, and the page gets parsed without the params.
Anyone know where to go from here?
How do I successfully use a ? in the URL of RedirectMatch and not get a 403 Forbidden?
Note: RedirectMatch works with a relative URL, Redirect(Temp¦Permanent)? does not.