Im trying to forward this url, but its not working - here is my code:
RewriteRule ^https://www.wsjwine.com/discovery_offer.as开发者_运维技巧px?promo=2227006$ https://www.wsjwine.com/discovery_offer_lp2.aspx?promo=2227006 [L]
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]
You can't detect query strings like that. Use RewriteCond %{QUERY_STRING}
.
精彩评论