URL Rewrite issue


Posted on 16th Feb 2014 07:03 pm by admin

Im created a series of Rewrites and on page checks to make sure the correct url is being called. But now that i am buying in traffic through Adwords the gclid parameter is being dropped and im unable to measure conversions...im not sure if its the php or the rewrite rule at fault...the rewrite rule im assuming. Im not sure if the ? is saying keep parameters or not.

Code: # page rewrite rule example http://www.mydomain.co.uk/location/1/name/
RewriteCond %{REQUEST_FILENAME} !-f
Did you know?Explore Trending and Topic pages for more stories like this.
RewriteRule ^location/([^/]+)/([^/]+)/? location-view.php?loc=$1&n=$2 [L,NC]

and on the page in question "location-view.php" i have the following:

Code: if (isset($_GET['gclid'])){

if ($_SERVER['REQUEST_URI'] != "/location/".$row_getlocation['location_id']."/".$row_getlocation['location_seo_name']."/?gclid=".$_GET['gclid']) {

header("HTTP/1.1 301 Moved Permanently");
header("Location: /location/".$row_getlocation['location_id']."/".$row_getlocation['location_seo_name']."/?gclid=".$_GET['gclid']);
exit;
}

}else if (!isset($_GET['gclid'])) {
if($_SERVER['REQUEST_URI'] != "/location/".$row_getlocation['location_id']."/".$row_getlocation['location_seo_name']."/") {

header("HTTP/1.1 301 Moved Permanently");
header("Location: /location/".$row_getlocation['location_id']."/".$row_getlocation['location_seo_name']."/");
exit;
}

}

thanks
No comments posted yet

Your Answer:

Login to answer
213 Like 46 Dislike
Previous forums Next forums
Other forums

header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1

PHP webpage & array print issue
I have this code running, and it works perfectly … however, see my bottom bit about what I see

Undefined Variable: PHP_SELF, pls help
Hi,

Im a newbie on PHP / MySQL programming and Im running a script to search one field on my

removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0m

Need help making a script that moves data into acrhive table
Hi,

I'm kinda new to php/mysql

And i wrote a simple script to store sales lead for a b

Uploading/Downloading files stored in MySQL database
Hey all,

This problem just came up in my website and I'm having a hard time figuring out what

mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My

Multiple PHP errors when clicking a link..and..removing a ghost..
Hi - I have 2 problems with a new website - homeswapvacations.com, which I need help solving.

PHP login form help (Done Most of It)
Hi i am having a problem, when i try logging in it is always saying "Invalid Login" im not

Help Ordering Arrays
Hi, I have 3 arrays as shown below.

Code: $users = $this->get_latest_users();
$flir

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash