LAMP--Apache 通过 rewrite 限制某个目录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LAMP--Apache 通过 rewrite 限制某个目录相关的知识,希望对你有一定的参考价值。

       限制网站根目录下的某个子目录,除了deny和allow外,还可以用 rewrite 实现,配置如下:

          <IfModule mod_rewrite.c>

             RewriteEngine on

             RewriteCond %{REQUEST_URI} ^.*/tmp/* [NC]

             RewriteRule .* - [F]

          </IfModule>

        这段配置,会把只要是包含 /tmp/ 字样的请求都限制了,比如下面的请求,在这里假设网站域名为 bbs.test.com 。

             bbs.test.com/a/tmp/123.html

             bbs.test.com/ab/tmp/123.html

             bbs.test.com/c/b/a/tmp/123.html


本文出自 “散宜生的学习笔记” 博客,请务必保留此出处http://sanyisheng.blog.51cto.com/11154168/1795833

以上是关于LAMP--Apache 通过 rewrite 限制某个目录的主要内容,如果未能解决你的问题,请参考以下文章