The 301 domain redirect is the best way to ensure that you keep SEO when moving from one domain name to another like olddomain.com to newdomain.com. The correct way to achieve this is by editing the .htaccess file of the old site on your server. The .htaccess file sits in your site’s root folder (directly under yourdomainname.com) and can be easily edited in the cPanel File manager or similar.
Open up the .htaccess file and add either of the following mod_rewrite declarations:-
You can also use
In both instances what this means is that you have to maintain limited hosting on your old domain to perform the mod rewrite. Don’t bother trying to edit CNAME or DNS records to achieve the 301 Domain Redirect as you need the old domain to correctly redirect to the new domain and that shoudl be server-side.
301 Redirects on SSL
You will note that in both instances we are using secure site redirects on SSL, as of course our sites should be secure. You may already be aware that Google wants you to Secure your site with HTTPS, so if you haven’t got an SSL then we advise asking your host to add a Free LetsEncrypt SSL for you. You really shouldn’t need to buy an SSL as these are just as good as paid for Standard SSL and in our eyes SSL should be a hosting prerequisite. If your host does not provide Lets Encrypt SSL then we recommend adding your own Lets Encrypt SSL to cPanel with SSL for Free. SSL For Free his a hidden gem of site that offers ‘Free SSL Certificates & Free Wildcard SSL Certificates in Minutes‘. Your host don’t want you to know this, but adding an SSL for Free really is very easy and SSL For Free has both vidoes and documentation that will help you breeze through this process.
It’s very important that you 301 Redirect a secure site to a secure site on SSL to ensure that both sites are ‘trusted’. The old domain therfore must maintain a valid security certificate as otherwise Google and other Search engines will throw up security errors like: –
"This connection is Not Private This website may be impersonating "domainname.com" to steal your personal or financial information. You should go back to the previous page"
By redirecting from a valid SSL on the old site to a valid SSL on the new site Google and others will trust the 301.
Make sure you update your site SEO
Moving your site may also mean that you have changed the site content at the same time. In this instance make sure you update your robots.txt file, your website site map and also add any specific page redirects. If you are on WordPress then many SEO Plugins will do this for you automatically. If you are lucky enough to be on Webflow, which is our preferred CMS platform, then you can aslo easily add page redirects from old pages to the new ones. With our preferred .htaccess redirect option above, these redirects will automatically reflect to the new page on the new site.
Make sure you tell Google you Have Moved your Domain
A 301 Domain Redirect is only part of the process and once implimented via your .htaccess you now need to tell Google you have moved from one domain to another. This is realtively easy via the Google Search Console and explained in this Google Article on Site moves with URL changes which also gives additional tips on this very topic.
Tell Google my Domain has changed
Here is how to tell Google your domain has changed: –
- Open up Google Search Console
- Submit a Change of Address in Search Console under Settings > ‘Change of Address’ for the old site. Do not submit a change of address if you are only moving your site from HTTP to HTTPS.
- Follow the instructions provided in the tool. The tool will run a few pre-move checks before telling Google about the move. If you fail any critical pre-move checks you will have to fix those first.
- If critical pre-checks pass, all sites being migrated from or to will display a notification in Search Console that the move is in progress. You will see these notifications for 180 days.
Google recommends that you maintain the redirects for as long as possible and indefinitely if possible, but do ensure at least the initial 180 days. You will need at least 180 days–longer if you still see any traffic to the old domain from Google Search during the initial 180 days.