Mobile app version of vmapp.org
Login or Join
Kevin317

: Permanent redirections after changing the product links structure on Prestashop I'm looking at changing the products URLs' structure on a Prestashop (v1.5) website. This process is quite straight-forward

@Kevin317

Posted in: #301Redirect #GoogleIndex #Htaccess #Prestashop #Seo

I'm looking at changing the products URLs' structure on a Prestashop (v1.5) website. This process is quite straight-forward and it can be done instantly through the corresponding admin panel.

The thing is, many of the products are indexed on Google (and other search engines too I'm guessing) so I'd like to 301-redirect the old links until the indexers update themselves with the new URLs. I'm guessing it's probably the safest way to handle the change: avoiding 404s and duplicates.

Since I have hundreds of products in this shop, I'm not looking to redirect them one by one, obviously. But then I don't really know how to manage the structure change properly within an htaccess file.

At the moment, I'm using the default Prestashop structure:

{category:/}{id}-{rewrite}{-:ean13}.html


Which produces the following links:
www.sitename.com/category/123456-product-name-0123456789123.html

I'm now looking at changing it to the following structure (which I think might be more efficient because you can find the same words on category and product names):

{rewrite}-{id}-{:ean13}


Which would produce this kind of link:
www.sitename.com/product-name-123456-0123456789123

But now I don't really know how to handle the change, if it can even be done easily?

And without any changes, the old links aren't automatically redirected to the new ones.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kevin317

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

Using a RedirectMatch directive from mod_alias in your .htaccess file should do the trick:

RedirectMatch permanent /[^/]+/([0-9]+)-(.*)-([0-9]+).html$ /--


This pulls out the matching parts of your old URLs and redirects them to the new format.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme