Force SSL on phpMyAdmin for versions greater than 4.6.0

phpMyAdmin is a great tool written in PHP intended to handle the administration of MySQL or MariaDB with the use of a web browser. For security reasons I have been using it over https. Till version 4.6.0 you could force using https instead of http with just configuring the config.inc.php

This was possible with adding the following line in your config.inc.php file


$cfg['ForceSSL'] = true;

When phpMyAdmin released version 4.6.0 informed its users that

The ForceSSL and PmaAbsoluteUri configuration directives have been removed(the functions of both of these should better be handled by the webserver than the application).
https://www.phpmyadmin.net/files/4.6.0/

So since I usually use apache the best way to achieve that was to create a file .htaccess inside the phpMyAdmin directory with the following contents


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Advertisements

One thought on “Force SSL on phpMyAdmin for versions greater than 4.6.0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s