apache 限制某些目录不能访问通过rewrite实现
2016-02-27 00:03
555 查看
通过deny allow访问控制肯定是可以实现的单个目录,但是这个必须指定准确的目录,如果有很多个目录,但是都包含某个名字,比如
bbs.1.com/1/tmp/123.html
bbs.1.com/2/tmp/123.html
bbs.1.com/3/1/2/tmp/123.html
……
如果有很多,需要逐一去定义Directory 模块,这显然很麻烦,使用rewrite模块的 REQUEST_URI 就可以很容易实现。 <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^.*/tmp/* [NC]
RewriteRule .* - [F]
</IfModule>
bbs.1.com/1/tmp/123.html
bbs.1.com/2/tmp/123.html
bbs.1.com/3/1/2/tmp/123.html
……
如果有很多,需要逐一去定义Directory 模块,这显然很麻烦,使用rewrite模块的 REQUEST_URI 就可以很容易实现。 <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^.*/tmp/* [NC]
RewriteRule .* - [F]
</IfModule>
相关文章推荐
- apache 限制指定user_agent
- apache 开启伪静态 Rewrite及检测
- 【手把手教你全文检索】Apache Lucene初探
- [Apache系列]怎样在windows下配置apache vhost
- Linux中Apache安装、配置、加为服务
- wdcp 打开网页显示 Apache 2 Test Page powered by CentOS
- VMware+CentOS+zookeeper+solr集群环境搭建_org.apache.solr.handler.dataimport.DataImportHandler
- VMware+CentOS+zookeeper+solr集群环境搭建_org.apache.solr.handler.dataimport.DataImportHandler
- 配置apache日志,分别记录不同搜索引擎爬虫的访问记录
- windows+apache+php+mysql快速搭建服务器环境
- 如何处理PB级别数据(2)——Apache Solr 之 使用SolrJ操作索引库
- org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.
- wamp3.0 apache vhost 设置之后,目录正确,却提示404
- apache 配置防盗链
- java第2类库——apache的IO处理包
- apache 的rewrite函数配置伪静态
- apache修改默认目录后访问拒绝
- Mybatis与SLF4J、Apache Commons Logging、Apache Log4J、JDK Logging等日志打印配置
- Centos设置开机启动Apache和Mysql
- win7 64位系统,apache2.4,php5.6.7安