Sometimes you want to change an old domain to a new one, below you'll find how to do it.
First, you log into your FTP account, and go to the root of your domain, if it's your primary domain this will usually be public_html, here you want to create (or edit) the file .htaccess (Remember there's a dot in front).
Here you put the following content:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?olddomain.com [NC]
RewriteRule (.*)$ https://newdomain.com/$1 [R=301,L]
</IfModule>
In this case, you have to replace olddomain.com and newdomain.com with the old and new domain.
The ^(www.)?
part ensures that the www version of the domain is matched as well. The question mark should stay.
Comments
0 comments
Please sign in to leave a comment.