At the moment, if a variable is added to the end of a URL the page is
loaded but the variable removed from the URL.
I need (for Adword tracking purposes) for whatever variable set, to
remain.
I am assuming this is to do with the rules set in the .htaccess file?
All pages are called from within /catalog/ the .htaccess from that
directory is below:
=====
Options +FollowSymLinks
RewriteEngine On
RewriteBase /catalog/
RewriteRule ^(.*)-p-(.*).html$
product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*).html$
index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*).html$
article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-(.*).html$
product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-(.*).html$
product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*).html$
information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
=====
Can anyone suggest how to make the random variable remain?
You should consider putting RewriteRule !\.html$ - [L]
on top to avoid wasting CPU time on not rewriteable requests.
> Can anyone suggest how to make the random variable remain?
Does that happens to be the part of the match before -*-?
Try (on one line)
RewriteRule ^(.*)-p-(.*).html$
product_info.php?products_id=$2&Ad=$1 [L,QSA]
Otherwise, do provide a sample.
HansH
Thank-you for your response, you can see the rewrite in effect at:
www.condomchoice.co.uk - please do let me know if you think the above
will work.
no, it does not work:
http://www.condomchoice.co.uk/catalog/x-p-2.html
gives error:
Warning: Cannot modify header information - headers already sent by
(output started at
/home/condomch/public_html/catalog/product_info.php:21) in
/home/condomch/public_html/catalog/includes/classes/seo.class.php on
line 1057
Warning: Cannot modify header information - headers already sent by
(output started at
/home/condomch/public_html/catalog/product_info.php:21) in
/home/condomch/public_html/catalog/includes/classes/seo.class.php on
line 1058
Product not found!
--
Luuk
>> Thank-you for your response, you can see the rewrite in effect at:
>> www.condomchoice.co.uk - please do let me know if you think the above
>> will work.
>
> no, it does not work:
> http://www.condomchoice.co.uk/catalog/x-p-2.html
>
> gives error:
> Warning: Cannot modify header information - headers already sent by
> (output started at /home/condomch/public_html/catalog/product_info.php:21)
> in /home/condomch/public_html/catalog/includes/classes/seo.class.php on
> line 1057
>
It is hard to blame a rewrite for a crash on a randomly choosen
product id used in a crafted -that is not provided- URL.
OP need to attend ot this issue seperately.
HansH
>>> Can anyone suggest how to make the random variable remain?
>>Does that happens to be the part of the match before -*-?
>>Try (on one line)
>> RewriteRule ^(.*)-p-(.*).html$
>> product_info.php?products_id=$2&Ad=$1 [L,QSA]
>>
>>Otherwise, do provide a sample.
>>
> Thank-you for your response, you can see the rewrite in effect at:
> www.condomchoice.co.uk - please do let me know if you think the
> above will work.
Obviously adding &Ad=$1will not do. The site shows the phrase before
the discriminator is a human readable reference to the product.
Do provide a sample of working URL showing where and what is
inserted or appended by Google. Most likely you can find good
samples in your site's accesslog.
HansH
Here is an example:
http://www.google.com/support/googleanalytics/bin/answer.py?hl=en-uk&answer=55590
Basically it appends gclid:
www.mysite.co.uk/?gclid=123xyz
That has the looks of just an extra query string element and should be
passed by
RewriteRule ^(.*)-p-(.*).html$
product_info.php?products_id=$2 [L,QSA]
A request for
/catalog/x-p-2.html?gclid=123xyz
should be rewritten into
/catalog/product_info.php?products_id=2&gclid=123xyz
Unfortunately you dit not provide a live sample, thus the above still is
theory...
Check Apache's access_log for any lines having a 'gclid=' phrase
HansH