Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-23-2009, 09:44 AM   PM User | #1
superguppie
New to the CF scene

 
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
superguppie is an unknown quantity at this point
Htaccess: problems with rewriting for the gclid querystring

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.
superguppie is offline   Reply With Quote
Old 04-26-2009, 08:07 PM   PM User | #2
schleppel
Regular Coder

 
Join Date: Oct 2004
Posts: 330
Thanks: 0
Thanked 13 Times in 13 Posts
schleppel is an unknown quantity at this point
Try
Code:
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?gclid= [NC]
RewriteCond %{REQUEST_URI} ^/$ [OR]
RewriteCond %{REQUEST_URI} ^(/.*[^/])/?$
RewriteRule !^(.+/)?redirect,$ %1/redirect, [R=301,L]
schleppel is offline   Reply With Quote
Old 05-04-2009, 09:38 AM   PM User | #3
superguppie
New to the CF scene

 
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
superguppie is an unknown quantity at this point
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?
superguppie is offline   Reply With Quote
Old 05-04-2009, 09:48 PM   PM User | #4
schleppel
Regular Coder

 
Join Date: Oct 2004
Posts: 330
Thanks: 0
Thanked 13 Times in 13 Posts
schleppel is an unknown quantity at this point
Do you have any more RewriteRules? Could you post them all.
schleppel is offline   Reply With Quote
Reply

Bookmarks

Tags
gclid, google adwords, htaccess

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:20 PM.


Advertisement
Log in to turn off these ads.