开发者

.htaccess ignore query_string adword

I'm trying to ignore a google adword get that is coming through.

Url coming in as:

/location/&gclid=287ejek22kj

This is going to a 404 page because of the gclid...

I need it to go to:

/location
开发者_开发技巧

I've tried this, with no success:

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)&gclid=(.*)$  $1 [L]

All help is appreciated. Thanks.


Works here:

192.168.1.2 - - [01/May/2011:05:38:48 +0100] [192.168.1.2/sid#938b98][rid#2789a40/initial] (3) [perdir C:/HTTP/htdocs/] strip per-dir prefix: C:/HTTP/htdocs/location/&gclid=287ejek22kj -> location/&gclid=287ejek22kj
192.168.1.2 - - [01/May/2011:05:38:48 +0100] [192.168.1.2/sid#938b98][rid#2789a40/initial] (3) [perdir C:/HTTP/htdocs/] applying pattern '^(.*)&gclid=(.*)$' to uri 'location/&gclid=287ejek22kj'
192.168.1.2 - - [01/May/2011:05:38:48 +0100] [192.168.1.2/sid#938b98][rid#2789a40/initial] (2) [perdir C:/HTTP/htdocs/] rewrite 'location/&gclid=287ejek22kj' -> 'location/'

Check your rewrite log. See RewriteLog and RewriteLogLevel.


Looks alright but you can also try this:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteRule ^([^&]+)&gclid=.*$ /$1 [L,NC,R=301]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜