skip to Main Content

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 ?

😀😀

2

Answers


  1. 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 🙂

    Login or Signup to reply.
  2. In your Apache config

    <VirtualHost *:80>
        ServerName www.domain1.com
        ServerAlias www.domain2.com
        ServerAlias www.domain3.com
        Redirect / https://www.domain1.com
    </VirtualHost>
    

    This redirects all http requests to the one domain for which you got a SSL certificate

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search