Protecting a directory from direct URL access

前端 未结 1 953
既然无缘
既然无缘 2021-01-14 09:17

need some help...

I need to protect all the FOLDERS in a DIRECTORY from direct URL access. Can I do this with .ht

1条回答
  •  悲哀的现实
    2021-01-14 09:44

    As Fabio points out - it's better to keep such files out of web root. But you still CAN use .htaccess to protect the files. They'll be guaranteed protected unless you accidentally delete the .htaccess or the sysadmin changes the main configuration (which sometimes happens).

    Just put a an .htaccess into the directory you want to protect, and put a single line in that .htaccess:

    deny from all
    

    0 讨论(0)
提交回复
热议问题