Subject: | Why isn't query string getting appended in rewrite rule? |
Posted by: | laredotornado (laredotorna…@zipmail.com) |
Date: | Mon, 16 Aug 2010 |
Hi,
I'm using Apache 2.2 on Mac 10.6.3. I have this rewrite rule in my
virtual host ...
RewriteRule ^/$ /context-path/index.jsp [QSA,R]
However, if I visit a URL like "mydomain.com/context-path/?src=1493",
the URL is rewritten as "mydomain.com/context-path/index.jsp" and the
query string is gone. Upon looking at my log, I can see this
happening ...
mydomain.com : 127.0.0.1 - - [16/Aug/2010:13:46:08 -0500] "GET /
context-path/?src=1493 HTTP/1.1" 304 -
mydomain.com : 127.0.0.1 - - [16/Aug/2010:13:46:08 -0500] "GET /
context-path/index.jsp HTTP/1.1" 200 8953
But i can't figure out why. How can I modify the rewrite rule above
to keep the query string?
Thanks, - Dave
============ Here's the complete virtual host directive
==================
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias vegas-dave
DocumentRoot "/Library/Tomcat/Home/webapps/vegas"
<Directory "/Library/Tomcat/Home/webapps/vegas">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
JkMount /context-path/* ajp13_worker
JkMount /getfile/* ajp13_worker
JkMount /context-path/tracking/leads ajp13_worker
JkMount /context-path/xmlBanner ajp13_worker
JkUnMount /context-path/error-pages/*.html ajp13_worker
RewriteEngine On
RewriteRule ^/$ /context-path/index.jsp [QSA,R]
RewriteRule ^/context-path/stay/hotels/details/([0-9]+)$ /context-
path/stay/hotels/details.jsp?companyId=$1 [PT]
RewriteRule ^/context-path/stay/hotels/details/([0-9]+)/([a-zA-
Z0-9_=&]+)$ /context-path/stay/hotels/details.jsp?companyId=$1&$2 [PT]
RewriteRule ^/context-path/my-vegas-images/([0-9]+)/([a-zA-Z0-9\-_\./
=&\s]+)$ /context-path/DownloadServlet?myVegas=true&path=$1/$2 [PT]
RewriteRule ^/web-images/(.*)$ http://www.mydomain.com.com/web-images/$1
[R,L]
RewriteRule ^/web-content/(.*)$ http://www.mydomain.com.com/web-content/$1
[R=301,L,NC]
RewriteRule ^/interactiveMapsBeacon$ /context-path/
interactiveMapsBeacon [QSA,R,NE]
RewriteRule ^/map-xml$ /context-path/map-xml [PT,L]
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 3
ErrorDocument 404 /error-pages/404.html
ErrorDocument 500 /error-pages/500.html
ErrorDocument 503 /error-pages/503.html
</VirtualHost>