Skip to content

Website: I need to deny access to directory but .htaccess doesn't work

Daniel Speichert edited this page Jan 30, 2016 · 1 revision

Sometimes you may want to deny public access to sensitive directories that are located in your public directory. You may be tempted to type "deny from all" in a .htaccess files but that does not work on nginx!

The correct solution is to modify the chmod (permissions) on the file or directory. Simply omit access to "others" using PuTTY or WinSCP. The command to do it over SSH:

chmod o-rwx /path/to/directory/or/file