What is the best way to hide a websites folder/ directory files
Create an index.html
or index.php
file inside, for example, the img
folder; so when a visitor attempts to visit yourwebsite.com/img/
and see the content, index.html
will be showed instead.
If your server is Apache you can setup an .htaccess file and build rules to hide/redirect and return a 404 Error page.
If your server is IIS then you can modify the "URL Rewrite" rules in your IIS Manager to return a 404 Error/Forbidden page.
See: .htaccess tips & tricks