Howto phpmyadmin and https
Hi Folks,
in this small tutorial I’m trying to explain how to make phpmyadmin working only with https. It’s really very easy so far. I did this on a Debian 5.03 Server but in most of cases it’s similar to any linux distribution. So let’s go:
- create a .htaccess file on /usr/share/phpmyadmin
cd /usr/share/phpmyadmin
vim .htaccess - enter the following lines:
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://yourdomain.or.IP%{REQUEST_URI} [NS,R,L] - save the file
wq! - after that open your phpmyadmin apache conf file
vim /etc/phpmyadmin/apache.conf - edit the following line to your script
# phpMyAdmin default Apache configurationAlias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride All
.
. - Now you can save the file => wq!
- restart your server
/etc/init.d/apache2 restart - Congratulations that’s all now you’ll be always redirected to https
This process can be done with all folders you want to be redirected to https. Just create a .htaccess file with the necessary lines and don’t forget to set up a <directory > tag into your available site.
For example I want to redirect a folder located in “/var/www/testfolder” . First you have to create and copy a .htaccess into the “testfolder” and then you should edit your current activ “sites-available” document like in the example below.
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory><Directory /var/www>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride None
Order allow,deny
Allow from all
</Directory><Directory /var/www/testfolder>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Tags: .htaccess, 443, apache2, directory, https, phpmyadmin, webserver