Redirect all WordPress posts to new domain

Reading Time: < 1 minute

You have migrated your WordPress site including all posts/database to a new domain and would like all URL’s redirecting to the new domain. This can be useful if a visitor locates one of your posts via a search engine and redirects to the same post on the new domain, rather than the homepage of the new site.

For example, when you visit the old post: http://oldsite.com/12/1/30/a-blog-post

You would like visitors redirected to the corresponding post at the new domain: http://newsite.com/12/1/30/a-blog-post

One of the ways you could do this is to amend the .htaccess file on your old wordpress site.

Take a backup of the old site and database

Remove all content from your old .htaccess file and replace with the below:

RewriteEngine on

RedirectMatch 301 /(.*) http://www.newdomain.com$1

All traffic including blog posts should redirect to the correct place on the new website.

If your new blog is not located on the root of the new doamin, for example, it’s now located on newdomain.com/blog, add /blog to the end so it reads http://www.newdomain.com/blog$

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.