Disable Directory Browsing using htaccess

隐身守侯 提交于 2020-02-03 07:59:26

问题


in my server I have a series of folders. I would deny the access to all this folders. How can I do? What rule I have to use?


回答1:


add one line in your .htaccess root:

deny from all

@QUESTION:

if you want to retain access for yourself:

allow from 192.168.1.1

subsitute in your real IP for the one i gave in the example.

so all together:

deny from all
allow from YOUR_IP

@QUESTION2:

if you deny access to a directory, you are denying access to all of the nodes in that directory like the "pages". if you are saying you want to deny access to a folder in the same level directory as the pages, move the htaccess to inside of that folder (simplest)

@EDIT:

Open your .htacces file
Look for Options Indexes
If Options Indexes exists modify it to Options -Indexes or else add Options -Indexes as a new line
The directory browsing feature should be disable by now

http://www.techiecorner.com/106/how-to-disable-directory-browsing-using-htaccess-apache-web-server/




回答2:


Add this to your .htaccess file,

Options -Indexes


来源:https://stackoverflow.com/questions/9627196/disable-directory-browsing-using-htaccess

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!