Redirect Old Domain to New Domain via .htaccess

Introduction

When moving your website to a new domain name, it’s crucial to correctly redirect all your old pages to ensure you retain the SEO benefits from existing links. Failing to do this properly can result in a significant drop in traffic from organic sources.

Why Proper Redirection Matters

Proper redirection preserves your site’s SEO value by ensuring that search engines and visitors are seamlessly directed to your new domain. This helps maintain your search rankings and traffic levels.

Simple Redirection Method

If your site structure remains unchanged and only the domain name is changing, you can use the following lines in your .htaccess file located at the root of your old domain to achieve a seamless redirect:

<IfModule mod_rewrite.c>
     RewriteEngine on  
     RewriteRule ^(.*)$ https://www.newdomain.co.uk/$1 [R=301,L] 
</IfModule>

Step-by-Step Instructions

Here’s a step-by-step guide to updating your .htaccess file:

1. Access Your .htaccess File

Navigate to the root directory of your old domain where the .htaccess file is located. This file is typically found in the public_html folder or the root directory of your website.

2. Edit the .htaccess File

Open the .htaccess file in a text editor and add the following code:

<IfModule mod_rewrite.c>
     RewriteEngine on  
     RewriteRule ^(.*)$ https://www.newdomain.co.uk/$1 [R=301,L] 
</IfModule>

3. Save and Upload

Save the changes and upload the updated .htaccess file back to the root directory of your old domain.

Explanation of the Code

The RewriteRule directive takes any request to the old domain and redirects it to the corresponding page on the new domain using a 301 redirect, which indicates a permanent move. The [R=301,L] flags ensure that the redirection is permanent and that no further rules are processed.

Conclusion

By following these steps, you can ensure that all traffic to your old domain is properly redirected to your new domain, preserving your SEO rankings and maintaining your site’s visibility.

Further Assistance

If you have any questions or need further assistance with redirecting your site to a new domain, please leave a comment below or reach out for support.

Leave a Reply

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