Getting /usr/share/phpMyAdmin to redirect to https from http

Hi All,

Spent most of today setting up a centralised phpmyadmin install, which I have got working, but I need to type httpS://domain.com/phpmyadmin to get it to work (which is all good) but when I do http://domain.com/phpmyadmin I get the following error:

The requested URL /phpmyadmin/navigation.php< was not found on this server.

Which is probably correct, as its only setup to run on HTTPS - the question is, how can I get it to auto re-direct to https?

I have tried all sorts, .htaccess in /usr/share/phpMyAdmin - that doesnt work.

I’ve also tried the re-write rule in etc/httpd/conf.d/phpmyadmin.conf, and that doesnt seem to work either, just doesnt want to re-direct for some reason?

Anyone got any ideas?

you may want to try this, it worked for me when I was messing with ispConfig

Solution:

add the following lines to your /etc/apache2/conf.d/phpmyadmin.conf (to perform the redirect)

RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} before the line containing:

Alias /phpmyadmin /usr/share/phpmyadmin

you may want to try this, it worked for me when I was messing with ispConfig

Solution:

add the following lines to your /etc/apache2/conf.d/phpmyadmin.conf (to perform the redirect)

RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} before the line containing:

Alias /phpmyadmin /usr/share/phpmyadmin

That was one of the rewrites I tried and it wouldn’t work.

Just want to mention that with Virtualmin, it’s recommended to not put websites in any other place than subdirectories of /home, because the version of suexec that comes with Virtualmin is compiled to execute stuff only from /home/*. So if you put sites elsewhere, you won’t be able to use mod_fcgid/suexec, except you compile things manually, which is not recommended.

You might want to create a virtual server, like “phpmyadmin.example.com”, and install phpmyadmin there. If you use a generic domain, like “myhosterdomain”, it’d be a global installation just as well.

Then how would I redirect domain1.com/phpyadmin to go do phpmyadmin.maindomain.com

what file did you put the re-write in? and did you restart apache after?