httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony VanScoy <tvans...@gmail.com>
Subject [users@httpd] mod_rewrite question, escaping quantifiers
Date Thu, 11 Aug 2005 20:28:31 GMT
I want to redirect certain requests to a pdf depending on a get
variable. nothing new, but I just can't get it to work. So I started
with the basics but just redirecting a certain page to a pdf, which
works.

RewriteRule ^/test\.php$ /pdf/somefile.pdf$ [R,T=application/pdf]

Which works fine. But, since I want to send different pdfs depending
on an ID,  I need to handle urls like this one...

/test.php?fileId=12

.. which in turn should redirect to ...

/pdf/pdfnumber12.pdf

... so i wrote this rule...

RewriteRule ^/test\.php\?fileId\=12$ /pdf/pdfnumber12.pdf [R,T=application/pdf]

.. which does not work. But even when I simplify the regex to just ...

RewriteRule ^/test\.php\?$ /pdf/pdfnumber12.pdf [R,T=application/pdf]

..it still doesn't work. So it seems like the question mark cannot be
escaped. I even tried

RewriteRule ^/test\.php[?]$ /pdf/pdfnumber12.pdf [R,T=application/pdf]

.. with no luck. This one works ...

RewriteRule ^/test\.php$ /pdf/pdfnumber12.pdf [R,T=application/pdf]

.. damn question mark. Anyone know what I'm missing? Am I approaching
this in the wrong manner?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message