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
46
Other forums
How a counter of users ? such as ---> (231 Viewing)
I want to count how many users are actually viewing the page, How is that possible?
Thank you guy
Little problem with form insertion in MySQL, Please help!!!
Hi!,
I'm a little bit new with php and I have a little issue here. I created a webform to ins
Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav
getting most records by count
Code: [Select]<?php
$connect = mysql_connect("localhost","dam
unoconv doc convert to pdf code prob
PHP/5.3.1
Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. Howe
Posting Serialized Data Not Working
I am trying to send an object from one PHP file to another using POST. I serialize the object and th
Change Age automatically
hi guys . im new to php , is it possible to change age value in mysql automatically when year change
Contact Form Not Working When I Add Validation Codes
So I built my first working PHP "Contact Us" like form. But, I have been trying to now mak
Web Application Recipe
Hi Guys!
I am working with the Web Application recipes. I am currently working on the sen
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
what is wrong with this
Code: [Select]<?php
if ($_SERVER['HTTP_REFERER'])
{