Apache + PHPMyAdmin - 将目录重定向到子域

So im running Apache on Ubuntu 16. I have phpmyadmin accessible via a directory because thats how it does it by default (e.g. to access phpmyadmin, I have to go to www.mydomain.com/phpmyadmin)

I wrote an Apache VHost to make it accessible via a subdomain as shown here in my Vhosts: http://pastebin.com/raw/tyZGbsSC

This works and now I can access phpmyadmin via a subdomain (phpmyadmin.mydomain.com) but the problem is that it is still accessible through the directory (www.mydomain.com/phpmyadmin)

How to i stop this?

There should be a conf file phpmyadmin.conf in /etc/apache2/conf-enabled which contains the following line

Alias /phpmyadmin /usr/share/phpmyadmin

Just comment out that line by putting a hash

#Alias /phpmyadmin /usr/share/phpmyadmin

and restart apache.

That should do the job.

You probably have the server-wide configuration enabled in /etc/apache2/conf-enabled

user@host:~ $ sudo a2disconf phpmyadmin

should disable it for you, or just remove /etc/apache2/conf-enabled/phpmyadmin.conf