1

I am currently redirecting

info.myurl.com/should-you-be-worried-about-apples

To

www.myurl.com/landing-page/

It is working fine with this

RewriteCond %{HTTP_HOST}  ^info\.myurl\.com$ [NC]
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^should-you-be-worried-about-apples/$ http://www.myurl.com/landing-page/? [R=301,NE,NC,L]

My problem is that should-you-be-worried-about-apples is also present on the site in multiple places with a tracking script attached to the end.

should-you-be-worried-about-apples?__hssc=&__hstc&hsCtaTracking=5a72d77e-2f14-4a70-bd75-47caf53582ac%7C849ebee6-7301-4822-9548-90eb9d5bf769

I can see that it has the variable 'hssc'. This is the commonality with all the tracking scripts. I've tried to rewrite it adding

RewriteCond %{QUERY_STRING} ^(.*&|)hssc=

But that isn't working.

How can I write this so that it captures the standard url as well as any url with tracking attached?

4

1 回答 1

0

您可以只允许查询字符串通过:

RewriteCond %{HTTP_HOST}  ^info\.myurl\.com$ [NC]
RewriteRule ^should-you-be-worried-about-apples/$ http://www.myurl.com/landing-page/ [R=301,NE,NC,L]

但如果这是一个特定参数的问题:

RewriteCond %{HTTP_HOST}  ^info\.myurl\.com$ [NC]
RewriteCond %{QUERY_STRING}  (^$|__hssc=)
RewriteRule ^should-you-be-worried-about-apples/$ http://www.myurl.com/landing-page/ [R=301,NE,NC,L]
于 2013-11-13T16:39:43.100 回答