Jump to content

Changing all 302 redirects to 301


Deminer84

Recommended Posts

Good morning,

 

In the past I had an option "Redirect to the canonical URL" set to "302 Moved Temporarily (recommended while setting up your store)".

 

Now I've set it to 301 Moved Permanently (recommended once you have gone live). From that moment, all different friendly URLs redirect to the proper one with 301. The problem is, all old redirects (many of them are important, like old categoriers etc) are still marked as 302.

 

I don't really want to regenerate htaccess, because I assume I will loose old redirects.

 

I want to change all 302 to 301. The question is, where are these redirects saved? Some specific file or database? I don't mean main htaccess file when I can add manually 301 redirects. I want to change the existing ones from the file they are already saved in.

 

 

Thank you,

Tom.

Link to comment
Share on other sites

@Johann

 

thank you so much. I'm changing it for every product.

 

I would like to ask one more question:

is it possible to do same thing to all categories, where their old URLs (before url change to different) still work somehow?

Link to comment
Share on other sites

As I can see, available value (in this case) is "301-category".

Next, column "id_type_redirected" changes value probably to category ID where it should redirect.

 

The problem is, when I change it in database, nothing happens in store.

In product SEO tab it's still listed 404 (as before).

When I disable product visibility in store, it still shows 404 on product page.

 

unfortunately @johann solution isn't working :/

 

 

I've found the solution.

 

The problem was the incorrect table. Proper one is ps_product_shop.

 

To apply @johann answer:

 

Set 301 redirect to category:

update ps_product_shop set redirect_type="301-category" where redirect_type=404

Then set a redirect to specified category:

update ps_product_shop set id_type_redirected=2 where id_type_redirected=0
Edited by Deminer84 (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

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...