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

213 Like 46 Dislike
Previous php-forum Next php-forum
Other php-forum

Firefox displaying PHP source code??
Currently testing a site thats almost built, am going to be including php on a sidebar on all pages

getAlexaRank($url) function not working
I have made a function to get alexa rank
the site is here: http://mytestsite.rack111.com/1

$_GET problem
Hi all,

Have a bit of a problem with a little piece of code, I am not sure if this should be

Strange array issue, never happened before.
mysql_fetch_array returns 1 array per call. Generally that's why it is inserted into a while statem

image upload script not working with png
The basic process of this php code is to take the submitted file, convert it to a small JPG thumbnai

Change snippet to use CURDATE
I am using time() in the snippet below, I would like to use CURDATE() and have the database setup fo

Warning: session_start() [function.session-start]: Cann.....
hi, can someone help me with this? I keep getting this error....

Warning: session_start() [fu

HTML Email rec'd as Source Code
The code does create and send the email successfully. However, the message shows as html code and n

Problem with an browser game.
Hello,i just joined that great forum and i got php prob,its kinda freaky...anyway i got browser game

How to search for several parameters from objects in a database?
I have a database with lots of information about objects.
Now I would like to search for 4 or 5 p

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