I used the following instructions to install phpMyAdmin into Centos 7 webserver:

wget https://files.phpmyadmin.net/phpMyAdmin/
tar xvzf phpMyAdmin-
mv phpMyAdmin- phpmyadmin
mv phpmyadmin /var/www/html/

Oddly (different from what I read in other questions), phpMyAdmin was installed here:
And the phpmyadmin config file is here:

With the default apache configuration, the website is viewed from /var/www/html and phpMyAdmin is viewed from /var/www/html/phpmyadmin, and looks like this in the URL:


So far so good, all working.

However, I added a virtual host and am now serving the website out of /var/www/foo.com/public_html

<VirtualHost *:80>
   ServerAdmin [email protected]
   DocumentRoot /var/www/foo.com/public_html
   ServerName foo.com
   ServerAlias www.foo.com
   ErrorLog /var/www/foo.com/error.log

It works if I mv /var/www/html/phpmyadmin /var/www/foo.com/public_html, but when logging in via FTP, I don't want the phpmyadmin folder to be visible under the /var/www/foo.com/public_html folder.

Is there a way to leave phpmyadmin in its original location at /var/www/html/phpmyadmin, but still be accessible via the url http://foo.com/phpmyadmin ?

  • Ideally you'd have your phpmyadmin files somewhere else and use an include/alias to bring them in to whatever host you want at whatever URL you want. Don't wanna go all distro war, but check out how Debian sets up apache config and brings in phpmyadmin when installed via apt - much better than what redhat/cent or net/freebsd
    – ivanivan
    Mar 9, 2018 at 2:00

2 Answers 2


You can actually put the folder anywhere as long as there is r-x permissions(not sure about write permissions).

For Apache v1:

Edit /etc/httpd/conf-available/phpmyadmin.conf or wherever the httpd folder is
Add the line Alias /phpmyadmin /location-of-folder if it is not already there
Run systemctl restart httpd

For Apache v2:

Edit /etc/apache2/conf-available/phpmyadmin.conf or wherever the apache2 folder is
Add the line Alias /phpmyadmin /location-of-folder if it is not already there
Run systemctl restart apache2


Just create symbolic link to your original phpmyadmin folder in /var/www/html => ln -s {path of phpmyadmin} /var/www/html/phpmyadmin folder and configure httpd to Allow symbolic links with FollowSymLinks option

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .