Skip to content
Advertisement

Redirecting all domains to a single https domain

I recently bought a hosting plan which provides three domains. Since there is only one version of my website, the idea is to redirect all the domains to one single domain ( I think this is also more SEO friendly). So my question is : How can I achieve that ? (Is it as easy as changing something in the .htaccess file?). And Is it possible to buy one SSL certificate for a domain and redirect all other domains ( which have no ssl certificates) to it ?

????????

Advertisement

Answer

in your .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ https://www.newdomain.com/$1 [R=301,L]

one damain – one certificate 🙂

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement