2/27/2020 - 9:32 PM

Redirect an old domain to a new domain. Setting Up a Permanent 301 Redirect in .htaccess

If you had an old domain such as example.com, and now you decided you actually want to use example.net for the website. You could setup a 301 redirect for the entire domain, so that old links to example.com carry over.

Source: https://www.inmotionhosting.com/support/website/setting-up-a-301-permanent-redirect-via-htaccess/

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]