Eck! Posted June 15, 2010 Share Posted June 15, 2010 Ive just added this to my site to redirect incorrect (but working) URLs to the correct one via a 301. Google had indexed the incorrect ones for some reason. For example, both of the following URLs worked, the first was indexed by google instead of the second (the correct one):/94-led-by-the-grey.html/fantasy/94-led-by-the-grey-YPD00160.htmlThis works in PS 1.2.4 but I havent tested any other versions, nor have I tested it with non-SEO URLs, but it works great for me.In product.php (root folder) round about line 120 just after where it says "/* rewrited_url set */" $defaultcategory = Category::getLinkRewrite($product->id_category_default, intval($cookie->id_lang)); $plink = $link->getProductLink($product->id, $product->link_rewrite, $defaultcategory, $product->ean13); $request = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; if(strcmp($plink, $request) !== 0) { header("HTTP/1.1 301 Moved Permanently"); header("Location: $plink"); } Link to comment Share on other sites More sharing options...
henrycr Posted August 18, 2010 Share Posted August 18, 2010 Friends this works well for PrestaShop version 1.1.0.5 or serious differentlyhenry Link to comment Share on other sites More sharing options...
mel- Posted August 26, 2010 Share Posted August 26, 2010 thank you so much for this ! works like a charm. Link to comment Share on other sites More sharing options...
aga63 Posted September 19, 2010 Share Posted September 19, 2010 Thank you very much for your contribution. Can you fix all the duplicate url problems? ie the category duplicate url's aswel?Have you told the admin team about your contribution? as it would benefit us all in the new version which shall be released Link to comment Share on other sites More sharing options...
ngruy Posted September 22, 2010 Share Posted September 22, 2010 Hello,This hack works ok with PS 1.3.1.1 and seo url on??Thanks! Link to comment Share on other sites More sharing options...
Timpet Posted November 21, 2010 Share Posted November 21, 2010 How will this effect the google sitemap? Link to comment Share on other sites More sharing options...
uddhava Posted November 25, 2010 Share Posted November 25, 2010 If you want to be sure about all SEO and URL rewriting done correctly you should definitely try Tomerg's suggestions and URL redirect Module.http://www.presto-changeo.com/content/6-prestashopseotips Link to comment Share on other sites More sharing options...
CataNic Posted November 26, 2010 Share Posted November 26, 2010 Thank you for this trick. It solve my online shop problem. However, I think this can be done by default by the Prestashop developers. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now