Hi David,
I´m having some problems with the url rewrite.
I have process like descripting in this page : http://www.pricetapestry.com/node/11
But i got this following problem :
On my home page i got a "over" link like this : ..URL../product/Beauty-sleep.html it's OK
But if i click on the link : i got this url : ..URL../product/product/Beauty-sleep.html and the page doesn't appear, i stay on my home page.
If i click on another link on the home page, i got this url : ...URL... /product/product/product/Corso-easy-cuir.html, and the page doesn't load.
I got this value on my config.php : $config_useRewrite = TRUE;
And if i click on the Brand/ Merchant and Category lonks, i got this url : ...URL.../merchant/brand/category/merchant/brand/brand/merchant/ and i stay on my home page.
Can you help me ? :)
Many Thanks (from France)
Fred.
Thanks David for your answer,
I got an htaccess file like this :
{code saved}
I have read , i must change $config_useRewrite = false; to $config_useRewrite = TRUE;
but in the htacess i don't really understand the modifications at line "RewriteBase On"
My script is in a folder that you can name folder1
Is it enough ?
Thanks for your help !
Sincerely
Fred.
Hi Fred,
Based on your config.php; the RewriteBase line in .htaccess should be just:
RewriteBase /
Cheers,
David.
Dave,
Everything is Ok with there instructions, dam !!!
C U 4 next questions :)
Fred.
Hi David,
My next question concern the URL structure.
Now, for featured products, i got URL like this : http://www.xxx.com/product/Beauty-sleep.html
How can i have url like that : http://www.shoeseo.com/category/brand-name/Beauty-sleep.html
After search product in the search field, i got this URL : http://www.shoeseo.com/product/AFLEUR.html
How can i have url like that : http://www.shoeseo.com/category/brand-name/AFLEUR.html
/////////
I do not understand why my file "sitemap.php" which is validated by google did not identify any url ???
Nom de fichier État URL indexées
sitemap.php?merchant=xxxx23 OK 0
sitemap.php?merchant=xxxx24 OK 0
sitemap.php?merchant=xxxrr OK 0
sitemap.php?merchant=xxxxbb OK 0
sitemap.php?merchant=xxxx.fr OK 0
sitemap.php OK 0
//////////
Many thanks for your answer.
Fred.
Hello Fred,
Regarding the URL structure - the first thing to do is to create the new rule in .htaccess for the new style of URL that you want, so in this case, look for the following line:
RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
...and add this new rule immediately BEFORE that line:
RewriteRule ^product/(.*)/(.*)/(.*).html$ products.php?q=$3&rewrite=1&%{QUERY_STRING} [L]
With that in place, it's just case of changing every location in the code that generates a product URL and changing it to use the new format.
For Featured Products, look for the following code around line 41 of index.php
$featured["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
...and REPLACE with:
$featured["products"][$k]["productHREF"] = $config_baseHREF.
($product["category"]?$product["category"]:"-")."/".
($product["brand"]?$product["brand"]?:"-")."/".
tapestry_hyphenate($product["name"]).".html";
For search results, look for the following 2 lines beginning at around line 166 of search.php:
$searchresults["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
if ($rewrite) $searchresults["products"][$k]["productHREF"] = "../../".$searchresults["products"][$k]["productHREF"];
...and REPLACE with:
$searchresults["products"][$k]["productHREF"] = $config_baseHREF.
($product["category"]?$product["category"]:"-")."/".
($product["brand"]?$product["brand"]?:"-")."/".
tapestry_hyphenate($product["name"]).".html";
...and finally in reviews.php, replace the following code on line 47:
$rows[$k]["productHREF"] = "../product/".tapestry_hyphenate($row["name"]).".html";
...with:
$rows[$k]["productHREF"] = $config_baseHREF.
($row["category"]?$row["category"]:"-")."/".
($row["brand"]?$row["brand"]?:"-")."/".
tapestry_hyphenate($row["name"]).".html";
Regarding the sitemap; sitemap.php returns a sitemap index, not an actual sitemap. Google then requests each URL in the index, which is where the actual URLs can be found. For example, if you browse to:
sitemap.php?merchant=xxxx23
...you will see the actual sitemap.
Cheers,
David.
Hi David And many thanks,
I made the changes but I still have errors.
In overview, the title link or the image of a featured product in home page corresponds to what I want :
http://www.xxx.com/xxx%20xxx/xxbrandxx/xxmodelxx.html
But there is no dash between the 2 words that make up the category (replace by %20) and make a 404 error page.
Can you help me ???
If click "By Category", the links are OK and generate perfect URL like this :
http://www.xxx.com/xxcategoryxx/
and if i click on a category : i got that perfect link too :
http://www.xxx.com/xxcategoryxx/xxxx-xxxx/
but if I click on a model in search results, I can access the page because the link is broken because it's missing the dash between the 2 words of the category. It was the same for the results after clicking "By Merchant" or "Brand".
[[ On the code that you gave me on your answer, there was a mistake since I changed :
($product["brand"]?$product["brand"]?:"-")."/".
Hello Fred,
To replace the spaces, in each instance of:
($product["category"]?$product["category"]:"-")."/".
($product["brand"]?$product["brand"]?:"-")."/".
...in index.php, search.php and reviews.php as described in the above changes, instead use:
($product["category"]?str_replace(" ","-",$product["category"]):"-")."/".
($product["brand"]?str_replace(" ","-",$product["brand"]):"-")."/".
...and similarly in reviews.php replace:
($row["category"]?$row["category"]:"-")."/".
($row["brand"]?$row["brand"]:"-")."/".
...with:
($row["category"]?str_replace("-","",$row["category"]):"-")."/".
($row["brand"]?str_replace("-","",$row["brand"]):"-")."/".
Plus...
There is another replacement required in sitemap.php. Look for the following code around line 32:
$sitemapHREF = "product/".urlencode(str_replace(" ","-",$row["name"])).".html";
...and REPLACE with:
$sitemapHREF =
($row["category"]?str_replace(" ","-",$row["category"]):"-")."/".
($row["name"]?str_replace(" ","-",$row["brand"]):"-")."/".
"product/".urlencode(str_replace(" ","-",$row["name"])).".html";
Cheers,
David.
Hi David and many thanks,
Everywhere, it's ok. In overview, links are correct, after click, urls are ok in the adress bar but i got a 404 for all product pages.
Can you help me ?
(in your last answer you tell me 2 times to midify "reviews/php" by 2 sorts of changes // is it normal ?)
Thanks,
Fred.
Hello Fred,
Could you email me a link to your site and your .htaccess and search.php as attachments and I'll check it out for you...
Cheers,
David.
Hello Dave,
It's ok for the URL rewrite, but i had always problems with my sitemap.php.
Youtell me : "Regarding the sitemap; sitemap.php returns a sitemap index, not an actual sitemap. Google then requests each URL in the index, which is where the actual URLs can be found. For example, if you browse to:
sitemap.php?merchant=xxxx23
...you will see the actual sitemap."
But currently I still have no pages indexed by google sitemap.
Even addresses: "sitemap.php?merchant=spartoo" or the number of url provided is 1059 and the indexed URLs are 0 (and it was the same for all dealers in my catalog). Why ?
Also, how do I update the site map when adding a new "Merchant" ?
Thanks for your answer.
Cordially,
Fred.
Hi Fred,
URLs are not indexed immediately (and bear in mind that some may not be indexed at all) there can be quite some time between submitting a sitemap and actually getting the URLs indexed (especially for a very new site). However you are normally told how many have been submitted pretty quickly - which is what you are seeing.
There is no need to do anything when adding a new merchant. As soon as you add a new feed / merchant to your site it is automatically reflected in the sitemap index (sitemap.php) so Google will find it in due course and subsequently request the new individual merchant or filename sitemap...
Cheers,
David.
Hello Fred,
Is your .htaccess in place with the correct RewriteBase?
If $config_useRewrite is TRUE, there must be a .htaccess in the same folder that you have installed Price Tapestry.
This can be made from a copy of htaccess.txt which you will find in the distribution. But also, it is important that in that .htaccess, the RewriteBase line is the same as your $config_baseHREF value in config.php.
For example, if your site is installed in the top level directory of your site; then in config.php:
$config_baseHREF = "/";
...and in .htaccess
RewriteBase /
However, if your site is in a folder, say /comparison/, then in config.php:
$config_baseHREF = "/comparison/";
...and in .htaccess
RewriteBase /comparison/
If you're not sure, if you could email me a link to your installation and your config.php and .htaccess files as attachments I'll check it all out for you...
Cheers,
David.