Jump to content

URL Rewrite issue


alwoodman

Recommended Posts

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.

 

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

 

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

 

Lee

 

Link to comment
https://forums.phpfreaks.com/topic/182640-url-rewrite-issue/
Share on other sites

the ? in the rule means that the rule will return true if there is a trailing slash or not (assuming that's the ? you're referring to).

 

nowhere in your location-view.php file do i see your loc or n variables.  i'm just not seeing the relationship between your RewriteRule and the file in question.

Link to comment
https://forums.phpfreaks.com/topic/182640-url-rewrite-issue/#findComment-963945
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.