robcub — 2012-10-08T18:57:44-04:00 — #1
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?
timigoe — 2012-10-13T07:55:00-04:00 — #2
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.
robcub — 2012-10-13T17:56:31-04:00 — #3
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.
scallioxtx — 2012-10-14T05:49:39-04:00 — #4
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.
robcub — 2012-10-14T07:43:46-04:00 — #5
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
timigoe — 2012-10-15T04:11:38-04:00 — #6
Excellent, glad it worked