M3Server Technical Blog FAQ redirect one domain to another via htaccess

redirect one domain to another via htaccess



So you bought another domain name that matches one you currently have.  You shouldn’t upload the same content else google will penalize you for duplicate content.  So, what to do?

The polite way to do this for your viewers, google, and ease of you updating multiple domains is to use a 301 redirect.

Here is how to do so:

Example domain: m3server.it (we want to redirect that to m3server.com)

– If you haven’t added the domain name to your m3control panel, please do so.

– Make a backup of your current .htaccess of the domain you want to REDIRECTED, not your final domain name.  In this case, we want to edit the .htaccess file of m3server.it.

Now, edit the .htaccess if it was a domain in use, or create a new .htaccess file:
COPY AFTER THE START AND BEFORE THE FINISH. Copy and paste the following:


#START
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.m3server.com$
RewriteRule ^(.*)$ https://www.m3server.com/$1 [R=301,L]
#FINISH

Save the file and upload it to the new site’s web directory like so:

m3server.it/.htaccess

This will redirect all page requests to m3server.com as shown.

Happy redirecting!

M3Server.com – Virtual Dedicated Servers

Leave a Reply