Forum Moderators: phranque
I have an existing ASP site running on apache. For a couple of reasons I want to redirect all attempts reaching documents in a doc directory to a single .asp page. That works fine today using RedirectMatch
BUT, when I try to add a request parameter using "?" after the file name, it converts to the url encoded "%3F" and the .asp file is not found.
How can I preserve the question mark (?) in my RedirectMatch?
RedirectMatch ^\/dir1\/(docdir\/.*)$1 http://example.se/check.asp?doc=$1
(ends up as http://example.se/check.asp%3Fdoc=docdir/mydoc.pdf)
Many thanks!
/Claes
[edited by: jdMorgan at 11:27 pm (utc) on Nov. 22, 2007]
[edit reason] examplified [/edit]
RewriteEngine on
RewriteBase /pros/full
RewriteRule ^(/se/documents/.*)$ checkDocPermission.asp?doc=$1 [NE]
But when I click the document link
http://www.example.se/pros/full/se/documents/assignment.doc
I am NOT redirected to checkDocPermission.asp.
Have I missed something essential...?
Thanks!
/Claes
[edited by: jdMorgan at 11:27 pm (utc) on Nov. 22, 2007]
[edit reason] examplified [/edit]
RewriteRule ^(se/documents/.*)$ http://www.example.com/checkDocPermission.asp?doc=$1 [R=301,NE,L]
It's usually better to start with "RewriteBase /" and then if you get an error, adjust it as needed based on your server error log information. Note that paths seen by RewriteRule in .htaccess do not include the leading slash, and that RewriteBase should include a trailing slash.
Jim