Beverleyh
06-03-2009, 08:02 AM
I'm using a php script that dynamically generates news articles and creates their urls in the following format:
http://www.website.com/news.php?pmax=5&&view_news=2009-02-27-21_1235769160
As you can probably guess, the only things that changes with each page is the string of numbers on the end that represents the dates of each article.
Anyway, I've noticed that the news articles are also being accessed via a url with only one "&" in the middle, although I'm not sure where this is coming from because all the links on my website point to the "&&" url.
This is throwing up problems in my stats/page views counters as one lot of data is being generated for this url:
http://www.website.com/news.php?pmax=5&&view_news=2009-02-27-21_1235769160
and another lot of data is being generated for this url:
http://www.website.com/news.php?pmax=5&view_news=2009-02-27-21_1235769160
As they are both the same article, I was wondering if .htaccess could be used to rewrite the url and only serve the "&&" url when the "&" one is requested?
(like saying, if a url beginning with "http://www.website.com/news.php?pmax=5&view_news=" is requested, change that part to "http://www.website.com/news.php?pmax=5&&view_news=" before serving the appropriate page)
I found this thread here which looks quite promising:http://www.webmasterworld.com/apache/3292629.htm but as I'm almost totally new to .htaccess, I couldn't get my head around it, so if someone could show me how to adapt it for my needs, that would be great.
Thanks
Beverley
http://www.website.com/news.php?pmax=5&&view_news=2009-02-27-21_1235769160
As you can probably guess, the only things that changes with each page is the string of numbers on the end that represents the dates of each article.
Anyway, I've noticed that the news articles are also being accessed via a url with only one "&" in the middle, although I'm not sure where this is coming from because all the links on my website point to the "&&" url.
This is throwing up problems in my stats/page views counters as one lot of data is being generated for this url:
http://www.website.com/news.php?pmax=5&&view_news=2009-02-27-21_1235769160
and another lot of data is being generated for this url:
http://www.website.com/news.php?pmax=5&view_news=2009-02-27-21_1235769160
As they are both the same article, I was wondering if .htaccess could be used to rewrite the url and only serve the "&&" url when the "&" one is requested?
(like saying, if a url beginning with "http://www.website.com/news.php?pmax=5&view_news=" is requested, change that part to "http://www.website.com/news.php?pmax=5&&view_news=" before serving the appropriate page)
I found this thread here which looks quite promising:http://www.webmasterworld.com/apache/3292629.htm but as I'm almost totally new to .htaccess, I couldn't get my head around it, so if someone could show me how to adapt it for my needs, that would be great.
Thanks
Beverley