Redirect posts from a one category to a new URL with .htaccess

I’ve been searching all over but can’t quite find exactly what I’m looking for so here goes.

I have quite a large blog and would like to move the posts from a specific category to a new domain and will need the old URL’s for just that category redirect to the new domain.

Read More

For example I have the category ‘paper’, I plan to export all the posts from WordPress in that category and import them to my new site on a new domain. so I want:

www.currenthome.com/paper/post-name-here

to redirect to

www.newhome.com/paper/post-name-here

I have over 900 posts which will need directing.

Just to be clear I only one the posts from one specific category to be redirected. The rest of the posts on the current site should not be affected.

Any help will be much appreciated!

Related posts

Leave a Reply

1 comment

  1. You may try this in the root .htaccess file of currenthome, below the WP rule-set:

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST}  (?:www.)?currenthome.com  [NC]
    RewriteCond %{REQUEST_URI}  ^/paper/([^/]+)/?      [NC]
    RewriteRule .*   http://www.newhome.com/paper/%1   [R=301,L]
    

    Redirects permanently:

    http://www.currenthome.com/paper/post-name-here or

    http://currenthome.com/paper/post-name-here with or without trailing slash.

    To:

    http://www.newhome.com/paper/post-name-here

    For silent mapping, remove R=301 from [R=301,L].