...

View Full Version : Htaccess: problems with rewriting for the gclid querystring



superguppie
04-23-2009, 09:44 AM
I have problems with rewriting for the gclid querystring (Google Adwords).
This is what I want:

http://www.domain.com/?gclid=abcdetc
should be:
http://www.domain.com/redirect,?gclid=abcdetc

http://www.domain.com/page/?gclid=abcdetc
should be:
http://www.domain.com/page/redirect,?gclid=abcdetc

http://www.domain.com/page/subpage/?gclid=abcdetc
should be:
http://www.domain.com/page/subpage/redirect,?gclid=abcdetc

This is a part of my htaccess:

## search for query string "gclid"
RewriteCond %{QUERY_STRING} ^(gclid=.*)$
## ignore url's with "redirect,"
RewriteCond %{REQUEST_URI} !(.*?)redirect,(.*?)$

... a redirect rule over here ? ...

## get mvc index to build site
RewriteRule (.*) /html/$1 [L]

Please tell me how to solve this.

schleppel
04-26-2009, 08:07 PM
Try

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?gclid= [NC]
RewriteCond %{REQUEST_URI} ^/$ [OR]
RewriteCond %{REQUEST_URI} ^(/.*[^/])/?$
RewriteRule !^(.+/)?redirect,$ %1/redirect, [R=301,L]

superguppie
05-04-2009, 09:38 AM
Thanks for your reply!

This is the result right now:
http://www.domain.com/index.php/redirect,?gclid=abcdetc

It rewrites "/page/subpage/" also to "index.php/"

I would like to rewrite the current path in it.
Do you have a solution for it?

schleppel
05-04-2009, 09:48 PM
Do you have any more RewriteRules? Could you post them all.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum