aws-templateswordpress-production-ready

Force HTTPS redirection with Apache

Follow these steps:

  • Add the following lines in the default Apache virtual host configuration file at /bitnami/apache/conf/bitnami/bitnami.conf, inside the default VirtualHost directive, so that it looks like this. Replace the DOMAIN_NAME placeholder with your domain name, if you defined one when configuring the solution, or the domain name associated with the application load balancer if not.

    <VirtualHost _default_:80>
      DocumentRoot "/opt/bitnami/apache/htdocs"
      RewriteEngine On
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
      RewriteRule ^/(.*) https://DOMAIN_NAME/$1 [R,L]
      ...
    </VirtualHost>
    

    NOTE: Bitnami WordPress Production-Ready Stack is only compatible with 2048-bit SSL/TLS certificates.

  • After modifying the Apache configuration files, open port 443 in the server firewall. Refer to the FAQ for more information.

  • Restart Apache to apply the changes.

Last modification June 16, 2020