In order to redirect http requests to https, we need to make some changes in the default apache configuration file. So, before we start, make sure to backup the current config file. So that we can revert the changes if something went wrong. The location of default configuration file in bitnami is “/opt/bitnami/apache2/conf/bitnami/bitnami.conf”.
sudo cp -apf /opt/bitnami/apache2/conf/bitnami/bitnami.conf /opt/bitnami/apache2/conf/bitnami/bitnami.conf_bak
Find the VirtualHost directive and add the following lines into it. It will look like:
<VistualHost _default_:80>
DocumentRoot “/opt/bitnami/apache2/htdocs”
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
…
</VirtualHost>
Restart apache to apply the changes
sudo /opt/bitnami/ctlscript.sh restart apache