Search code examples
phpmysqlubuntuphpmyadminbitnami

Deny access to folder directly


I have bitnami based instance with apache and php. I want to secure the phpmyadmin folder, I have read many tutorials on internet , what I did now is that I changed the

Alias /secret/ "/opt/htdocs/phpmyadmin/"

and thats how I am accessing the phpymyadmin folder using mydomain.com/secret. but still user can access the folder phpmyadmin , How can I restrict this?

Thanks


Solution

  • This is because you seem to have put the phpmyadmin folder in your web root -- when using an Alias, you'll normally want to put it somewhere outside of the /opt/htdocs/ folder (anywhere, really; if it were me I'd probably just put it in /opt/phpmyadmin/ but you can put it wherever you want). Update your Alias to point to the correct folder.

    Since right now you also have the phpmyadmin folder in the web root, when you try to connect to http://example.com/phpmyadmin then Apache looks in the web root and finds the matching folder. When you look for http://example.com/secret, the alias takes over, but the net result is the same either way.