Arda Basoglu

Bitnami AWS WordPress: Applying HTTPS and WWW Redirection Configuration

If you have Bitnami WordPress for AWS Cloud with a load balancer and you installed your SSL certificate, there is some configuration you have to make so that your site can operate properly.

By applying these settings mentioned here, you will manage to redirect non www calls to www calls and redirect HTTP traffic  to HTTPS on your load balancer.

I’m assuming that you have access to your WordPress installation folder via FTP.

Here are the steps:

  • Go to  /opt/bitnami/apps/wordpress/conf folder.
  • Find the httpd-prefix.conf file and download it.
  • Add the below text at the end of that file and save the file.

        #################################################################################
        # redirect from non www to www
        # https://stackoverflow.com/questions/1100343/apache-redirect-from-non-www-to-www
        #################################################################################
        RewriteEngine On
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

       #################################################################################
       # How do I redirect HTTP traffic on my server to HTTPS on my load balancer?
       # https://aws.amazon.com/premiumsupport/knowledge-center/redirect-http-https-elb/
       #################################################################################
       RewriteEngine On
       RewriteCond %{HTTP:X-Forwarded-Proto} =http
       RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]

  • Upload your edited file back into /opt/bitnami/apps/wordpress/conf folder.
  • Restart Apache server by issuing the “sudo  /opt/bitnami/ctlscript.sh restart apache” command using your SSH connection.

Note: I left the code comments with the links in order for you to investigate further if something goes wrong.

I hope this helps someone out there 🙂