ssldrupallampmediatemple

Drupal Domain Redirection


We have two domains: www.example.com and www.example.org. Both point to the same site. But, we'd like everything to point to .org. We are running Drupal on a LAMP server hosted by Media Temple.

We have now started to have problems because our .com SSL cert expired, so anybody who goes to the .com site routinely gets scary messages in Chrome, etc.

How can we make it so that if somebody goes to https://www.example.com in google, they get nicely directed to http://www.example.org?


Solution

  • You can do this multiple ways.

    .htaccess

    RewriteEngine On
    Redirect 301 / https://www.exmaple.org
    

    In a PHP file

    header("HTTP/1.1 301 Moved Permanently");
    header("Location: https://www.example.org");
    header("Connection: close");