大家好!
假如我有一个web应用,目录为my_app,放到apache的应用程序根目录中,我想限制浏览器访问my_app/templates目录,该目录存放了一些html模板,如登录注册框之类的。能进行限制吗,该如何做?
假如我有一个web应用,目录为my_app,放到apache的应用程序根目录中,我想限制浏览器访问my_app/templates目录,该目录存放了一些html模板,如登录注册框之类的。能进行限制吗,该如何做?
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from none
</Directory>试试
将内容写到templates目录下面的.htaccess文件也不行,这个就没重启服务器。额,我菜鸟啊。
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>templates目录下建立文件.htaccess,如下内容:
Options None
AllowOverride None
Order deny,allow
Deny from all这样子可以了。尝试访问templates目录下面的文件,会得到如下错误:
Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.