I have a WordPress site with a Permalink of /%category%/%postname% of over 350 blog posts and I want to change it to just postname /%postname%
I have a few questions.
Is there any quick way to do the redirects? So say I have a category of "fruits" could I put something in the htaccess that would redirect all posts that were originally site.com/fruits/postname to site.com/postname?
And, secondly, it is bad to have too many redirects in an htaccess file? Would 350 slow down the site?
If the postname is staying the same, you'd just need one rule per category to do the redirects - i.e. /category/postname -> /postname - the rule would jsut throw away the category.
Thank Tim. So redirects in .htaccess like this:
redirect 301 /fruits/ http://www.yoursite.com/
redirect 301 /vegetables/ http://www.yoursite.com/
... where "fruits" and "vegetables" are categories will redirect all the individual blog posts from category/blogpost to /blogpost.
Not quite, as that just redirects the category level but nothing under it. What you'd need to use instead is RedirectMatch, i.e.
And of course make sure there aren't any posts called "fruits" or "vegetables" etc, as those would get redirected as well.
Really appreciate you help of this one, Scallio and TimIgoe. I couldn't find this information out by Googling.
Here's what I used and it worked:
RedirectMatch /categoryname1/(.*) http://www.site.com/$1
RedirectMatch /categoryname2/(.*) http://www.site.com/$1
RedirectMatch /uncategorized/(.*) http://www.site.com/$1
Excellent, glad it worked
This topic is now closed. New replies are no longer allowed.