I created a custom post type (collections) and taxonomy (collection_categories) with 4 terms (paintings, drawings, sculptures, past sales),

now I want to change my site url,

old url is www.mysitename.com/collections/post-name,

I made a custom post type rewrite "collections" which is now "collection" and I added the related taxonomy terms in the url,

now is www.mysitename.com/collection/paintings/post-name or www.mysitename.com/collection/drawings/post-name etc.

The url to redirect more than 150, so I wanted to know if there was an easy solution to this.

How can I make a redirect the old url to the new? Sorry for my english

1 Answer 1


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.

  • ok, thank anyway, The next time I will try to better Working On URL.
    – pacc88
    Nov 25, 2016 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.