How-to Set Up 301 Redirects to Maintain WordPress SEO

February 9, 2012
Laptop wordpress dashboard

When moving a web site from one domain to another domain or subdomain, permanent redirects (known as 301 redirects to the web server) are vital to keep existing search engine links working. There are a few ways to do this, but I’ve found the easiest way is to set up the old domain to use a special file that the web server looks at for per-folder configuration information. This file is named “.htaccess” and is placed in the folder you want the server to modify it’s configuration for. For WordPress, I put it in the root folder with the core WordPress files.

Inside the .htaccess file, add the following lines:

#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^interactivemarketingcafe.com [OR]
RewriteCond %{http_host} ^www.interactivemarketingcafe.com
RewriteRule ^(.*) https://brandswithfansblog.fandommarketing.com/$1 [R=301,L]
RewriteCond %{http_host} ^brandswithfansblog.com [OR]
RewriteCond %{http_host} ^www.brandswithfansblog.com
RewriteRule ^(.*) https://brandswithfansblog.fandommarketing.com/$1 [R=301,L]

The first two lines set it up to do rewriting of URLs, uncommenting (removing the #) on the first line if redirection doesn’t initially work. The middle three lines match the old domain name (with or without www), and redirects it to the new domain or subdomain, keeping everything after that intact. The last three lines match a different domain, so you can do multiple domains within one file. In the hosting set up, the old domains could point to the new domains, or be on an old or separate hosting account, and do the redirection to the new domain on a different hosting account.

Using this method, we have the old web links redirecting to the new domain, using wildcards matching anything after the domain. Easy and quick.

For any links that may not have a new corresponding page, use a permanent redirect on the new domain to redirect them to a new corresponding web address, or if none, to the home page. When using WordPress, there is a great plug-in named Redirection, that handles redirects as well as logs and tracks Page Not Found errors (401 errors), with automatic redirection to the home page, it’s highly recommended.

For more WordPress support check out these helpful articles from our WordPress Expert Series:

How to Optimize RSS to Display Featured Blog Images

Why the 1-Click WordPress Install Should Be Avoided

3 Surprising WordPress Uses Beyond Blogging for Business

WordPress for Enterprise Facts, Myths, and Tips for Success

Share

You Might Also Like

2 Comments

  • Reply How to Set Up 301 Redirects to Maintain Wordpress SEO | Web Wizards March 27, 2012 at 7:02 am

    […] the full post at: How to Set Up 301 Redirects to Maintain WordPress SEO Posted in Internet Marketing, Search Engines, […]

  • Reply How to Set Up 301 Redirects to Maintain Wordpress SEO - Press Wizards February 15, 2016 at 9:48 am

    […] Read the full post at: How to Set Up 301 Redirects to Maintain WordPress SEO […]

  • Leave a Reply