拒绝访问URI [英] Deny access to URI

查看:190
本文介绍了拒绝访问URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图拒绝访问特定URI,即 /管理/ ,并尝试这个.htaccess文件:

I'm trying to deny access to a certain uri, namely /admin/ and have tried this .htaccess file:

SetEnvIf Request_URI !^/admin/ not_admin_uri

Order deny,allow
Deny from all
allow from 356.244.33.
allow from env=not_admin_uri

本作品为例如IP范围,而不是为not_admin_uri的部分。

This works for the example IP range, but not for the "not_admin_uri" part.

这是怎么回事错在这里?

What's going wrong here?

推荐答案

要否定匹配你不能把 SetEnvIf之后指令。你需要使用负向前查找是这样的:

To negate a match you cannot place ! in the SetEnvIf directive. You need to use negative lookahead like this:

SetEnvIf Request_URI ^/(?!admin/) not_admin_uri

这篇关于拒绝访问URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆