phpMyAdmin

How do I force https? It seems to always use http? :(

I changed my config file to use SSL, but it still doesn't redirect.

6 Replies

Just use apache rewrite:

# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

 <directory usr="" share="" phpmyadmin="">Options FollowSymLinks
    DirectoryIndex index.php

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

    <ifmodule mod_php5.c="">AddType application/x-httpd-php .php

        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_value include_path .</ifmodule></directory> 

doh.. I always make the dumbest mistakes.. xD

If you go through;

mysite.com/phpMyAdmin/setup/

^ You can setup your mysql settings.

Once your done, you can do the following;

rm -rf setup # We don't need the setup folder anymore…

mv config/config.inc.php config.inc.php # Move the saved config file.

rm -rf config # Remove the config folder.

Then it automatically resets to https mode, although sometimes it doesn't work right.. thanks for the .htaccess rewrite code :D

No need to use rewrite. You can just use Redirect. It doesn't get simpler than this! :) Here's something very similar to what I use on my linode:

 <virtualhost *:443="">ServerName mydomain.com

  CustomLog /var/log/apache2/mydomain.com/access.log combined
  ErrorLog /var/log/apache2/mydomain.com/error.log
  SSLEngine on
  SSLCertificateKeyFile /etc/ssl/ssl.key/mydomain.key
  SSLCertificateFile /etc/ssl/ssl.crt/mydomain.crt
  SSLCertificateChainFile /etc/ssl/ssl.crt/mydomain.ca-bundle</virtualhost> 
 <virtualhost *:80="">ServerName mydomain.com
  Redirect / https://mydomain.com</virtualhost> 

Then Apache will just autoredirect from http to https.

found a easier method, but I used some of your code to do it. I manually set a https redirect in my vhost;

# Force https:// on phpMyAdmin login.
Redirect /path/to/pma https://example.com/path/to/pma/

Works great! :)

I follow instructions in

~~[http://library.linode.com/security/ssl-certificates/self-signed" target="_blank">](http://library.linode.com/security/ssl- … elf-signed">http://library.linode.com/security/ssl-certificates/self-signed](

And I don't know where the *.crt file is : (

don't forget to issue these commands:

sudo a2ensite default-ssl

enables HTTPS for your apache2 install (even though the apache2/sites-available/default-ssl file is configured for HTTPS)

and of course restart

sudo /etc/init.d/apache2 restart

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct