Jump to content

htaccess rules to redirect 1.6 brands url to 1.7 ones


Recommended Posts

Hi everyone! 

Thanks in advance if you can help! 

I'm looking to write a rule in the htaccess of my recently migrated 1.7 shop

I was thinking that prestashop would have made the redirection of the old urls for the brands but after checking the indexed urls on Google it appears that their pointing to a 404 error page

Could you help me to write the htaccess rules with the right regex? 

It seems that on 1.6 the urls for the brands were :

ID_BrandName

 

And on 1.7 it's : /brand/ID-BrandName

 

Thanks for everything! 

Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...
On 5/20/2019 at 7:54 AM, KeydownR said:

If it can help anybody


#Htaccess
# Brands
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^([0-9]{1,5})_(.*)(?<!xml)$ /brand/$1-$2 [R=301,L]

Have a nice day

I need this but this code did not work for me. 

Link to comment
Share on other sites

10 minutes ago, Mr. Trice said:

I need this but this code did not work for me. 

This is what worked for me. 

 

#Htaccess
# Brands
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^([0-9]{1,5})_(.*)(?<!xml)$ /brand/$1-$2 [R=301,L]

Link to comment
Share on other sites

29 minutes ago, Mr. Trice said:

I need this but this code did not work for me. 

This is what worked for me. 

 

#Htaccess
# Brands
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^([0-9]{1,5})_(.*)(?<!xml)$ /brand/$1-$2 [R=301,L]

 

But i have one issue now. It affects Suppliers with thesame ids of brand 

Link to comment
Share on other sites

  • 11 months later...

I know its old topic , but i want to do opposite. We have newer version of presta and links in Brands tab are okay with "_" but our sitemap generator still wants to index some sites like /brand/83-brandname?page=3 with hyphen so for seo we don't want 404 with robots. I tried just to switch hyphen with underscore from rules from this post but nothing works, or maybe i'm editing wrong .htaccess . ON which one i should focus for brands? The one in main folder or should i create new one in some other folder?

Edited by CPTBombaxx (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...