I have a site https://example.comto ensure that all users go to the https:// I set up a redirect with APACHE (on the default.conf) as followed:

<VirtualHost *:80>
        ServerName example.com
        Redirect permanent / https://example.com
        # DocumentRoot /var/www/example.com/
<VirtualHost *:80>

My issue is when I try to access my phpmyadmin example.net/phpmyadmin I redirect to https://example.net/phpmyadmin and the page cannot be displayed. (It is obviously working if I remove the Redirect). How can I get avoid the redirect only for my phpmyadmin? Any idea?

2 Answers 2


You could disable ForceSSL within PHPMyAdmin but there's a reason why its forced and this is to make the connection more secure. I recommend that you move to doing redirects using .htaccess rather than using virtualhost method, by doing so you have more control on your redirects for each of your web applications.

In /var/www/.htaccess it should look something like:

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

then in /usr/share/phpmyadmin/.htaccess use something like:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  • Thanks a lot. I was trying to avoid mod_rewrite has it is said to be only a last resort solution httpd.apache.org/docs/2.2/rewrite/avoid.html. But your solution seems really nice too.
    – Raphael_b
    Commented Feb 12, 2015 at 12:46
  • 1
    "redirects using mod_rewrite rather than using virtualhost method" - I think this should be "mod_alias" rather than "virtualhost"? You can use mod_rewrite (RewriteRule) in a VirtualHost context just as you could use mod_alias (Redirect).
    – MrWhite
    Commented Feb 12, 2015 at 13:01

A way around: I do not know why but if I type as url example.net/phpmyadmin I will be redirected to https://example.netphpmyadmin/ but if I write https://example.net/phpmyadmin/ (with the /)I go to php my admin. No idea why but I hope it will be of help to others.

to force https:// on pyp myadmin I added: $cfg['ForceSSL'] = true; at the end of phpMyAdmin’s config.inc.php file (see http://thebarton.org/forcing-ssl-with-phpmyadmin/).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.