redirect 301 old url to new url

Well, you would have to add some re-write rules in your .htaccess file (unless there’s a plugin that can allow more complex 301 redirect rules).

But, in your situation, if I understand correctly, it’s simply not possible to do it in one generic rewrite rule, due to the logic of your new URLs…

If all of your collections are at `mysitename.com/collections/post-name’ then it’s not going to be possible to write a general rewrite rule to redirect them all to the desired place.

Only you know which categories each needs to go into. So, you’ll (unfortunately) have to write a line in .htaccess for every single post, in the following format:

Redirect 301 /collections/{post_x} http://mysitename.com/collection/{collection_category}/{post_x}

If ALL posts were going to go into one category, then you could write one generic rule. E.g. if you were to add all posts to the Paintings category:

RewriteRule ^collections/(.*)$ /collection/paintings/$1 [R=301,NC,L]

But, yeah, if I understand you correctly, you are going to have to go with the former, and write one line for each post.

Leave a Comment