Posted on

.htaccess file – Redirect old domain to new domain

.htaccess file ( most times you can ask your host to do this for you ):
open up your .htaccess file and put the following into it. (OLDDOMAIN is for your previous one and NEWDOMAIN is for your new one)

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC,OR]
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]

If you cannot see your .htaccess file, you’ll need to go into your cpanel and change the settings.

Once done, when someone accesses your old domain, they should be redirected to the new one. 🙂