phpMyAdmin over SSL

I get asked this question a lot: “How can I force phpMyAdmin to run over https ‘SSL’?” It is basically an issue to deal with security. Since phpMyAdmin deals with directly accessing your database, it only makes sense you want to make it as secure as you can. While running over SSL ‘HTTPS’ is not the total solution, it does help. So, here is how to make it run over SSL.

Assuming you already have SSL installed and configured correctly in your webserver for whatever directory phpMyAdmin is in, open up the index.php file, and at the very top, just after the comments end, but before the includes”, add these few lines:

if '$_SERVER["SERVER_PORT"] != 443'{
$head = "Location: https://" . $_SERVER["HTTP_HOST"] .  $_SERVER["REQUEST_URI"];
header'$head';
exit;
}

That’s it. It will force your page loads to go through HTTPS.

  • Share/Bookmark