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
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

iterating through an array and escape each value independently.
I have a set up where the variable being escaped is an array and it needs to be iterated and escaped

value not going in data base
hello friends....
i am having a working javascript....when i am selecting any

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

Checking if multidimensional array is empty?
I have a for with multiple test input fields. Specifically the user submits multiple names and ages

Business Health Check
Hello

I need to create an online business health check for a client it will be multiple choi

php forms and database navigatio
Hello,
I'm new to php and i'd like to post the following.
I have written code to get records f

Display error above the login forum help!
Hi guys. just so you know im not asking for someone to do this for me I just need to be pointed in t

Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.

when I go

Oracle Text CTX_DOC.snippet slow
I have a table (FILE_TABLE) that contains a blob column (ft_file) and I have created the following O

PHP code needed to get/post form fields and request mysql query results.
I'm new to PHP

I've created an html form to allow the user to request a basic telephone dire

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