tags:

views:

21

answers:

2

Im trying to forward this url, but its not working - here is my code:

RewriteRule ^https://www.wsjwine.com/discovery_offer.aspx?promo=2227006$ https://www.wsjwine.com/discovery_offer_lp2.aspx?promo=2227006 [L]
A: 

You can't detect query strings like that. Use RewriteCond %{QUERY_STRING}.

Ignacio Vazquez-Abrams
A: 

With RewriteRule directive you can only test the URL path. For further tests you need to use additional RewriteCond directives.

Now if you want to rewrite every request of /discovery_offer.aspx to /discovery_offer_lp2.aspx regardless of how the query looks like, you can just use this (example for the .htaccess file in the root directory):

RewriteRule ^discovery_offer\.aspx$ discovery_offer_lp2.aspx [L]

If you don’t specify a query in the substitution, the originally requested query is automatically appended to the new one.

And if you just want to rewrite that specific URL, try this:

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} =www.wsjwine.com
RewriteCond %{QUERY_STRING} =promo=2227006
RewriteRule ^discovery_offer\.aspx$ discovery_offer_lp2.aspx [L]
Gumbo
Awesome, exactly what I was looking for!
jrutter