Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GTS-MEG's avatar

Change phpmyadmin port + url

As the title said, I changed phpmyadmin port to 99 through adding a virtual host file at /etc/apache2/sites-available, the file looks like :

Listen 99
<VirtualHost *:99>
        ServerName localhost
        Alias /secreturl /usr/share/phpmyadmin
        <Directory /usr/share/phpmyadmin>
                AllowOverride None
                Require all granted
        </Directory>
        DocumentRoot /usr/share/phpmyadmin
        Include /etc/phpmyadmin/apache.conf
        ErrorLog ${APACHE_LOG_DIR}/phpmyadmin.error.log
        CustomLog ${APACHE_LOG_DIR}/phpmyadmin.access.log combined
</VirtualHost>

The issue is when I access the url IP:99 I get access to phpmyadmin without adding the secret url to the url, how do I prevent this ?

0 likes
1 reply
tomasnorre's avatar

How is read the config, it's because the Alias /secreturl /usr/share/phpmyadmin and the DocumentRoot /usr/share/phpmyadmin are the same.

Therefore, the alias isn't needed. So change your DocumentRoot to something else.

PS: "security by obscurity" can not be recommended. Add and Auth-basic or something instead or on top.

Please or to participate in this conversation.