Redirect All HTTP Traffic To HTTPS (Port 443)

Redirecting website HTTP (port 80) traffic to HTTPS (port 443) is very easy under Apache.

  1. Open the website’s HTTP VirtualHost file.
  2. Inside the VirtualHost block, near the very end, add line (with your website’s primary domain name substituted in):
    Redirect / https://www.example.com/
  3. Also make sure the HTTPS VirtualHost file does not have a similar line in it that redirects back to HTTP, or your Browser will go into a loop.
  4. Save VirtualHost files. Restart Apache.
    1. For this to work correctly, without any Browser warnings, your website will need to have the proper SSL Certificates installed. Most Browsers will not allow you into a website that is using self-signed certificates (nor mismatched “Common Name” / domain name certs).

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>