1

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?

1

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]
| improve this answer | |
  • 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 Feb 12 '15 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 Feb 12 '15 at 13:01
0

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/).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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