want to protect your phpmyadmin directory from unauthorised access? i do. tried the usual .htaccess tricks but couldn’t get them to work… don’t know if it was to do with /var/www/phpmyadmin being a symbolic link of /usr/share/phpmyadmin or something else. i’m using debian but your setup should be similar if you’re using apache 2.
i wanted only computers on my local network to be able to login (or if i connect remotely using an ssh tunnel) so one solution is to add the following to the end of /etc/apache2/apache2.conf (remember to back up your original apache2.conf before you start tinkering)
#deny access to phpmyadmin
<Directory /var/www/phpmyadmin>
Order Deny,Allow
Deny from all
Allow from 10.0.0.1/24
</Directory>
you’ll need to the reload apache using
/etc/init.d/apache2 reload
if you wanted to add another IP address or domain insert another Allow line like this
#deny access to phpmyadmin
<Directory /var/www/phpmyadmin>
Order Deny,Allow
Deny from all
Allow from 10.0.0.1/24
Allow from .yourdomain.com
Allow from 102.51.333.65
</Directory>
and reload apache again.