Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 是否要阻止对特定URL的访问,例如通过htaccess?_Apache_Security_.htaccess - Fatal编程技术网

Apache 是否要阻止对特定URL的访问,例如通过htaccess?

Apache 是否要阻止对特定URL的访问,例如通过htaccess?,apache,security,.htaccess,Apache,Security,.htaccess,我需要阻止访问我的网站内的特定网址。但我不知道该怎么做,而且在理解htaccess的复杂性方面也很糟糕^^ 我需要阻止访问这些类型的URL的访问,例如 我的当前访问代码 DirectoryIndex index.html index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|c

我需要阻止访问我的网站内的特定网址。但我不知道该怎么做,而且在理解htaccess的复杂性方面也很糟糕^^

我需要阻止访问这些类型的URL的访问,例如

我的当前访问代码

DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?sef_rewrite=1 [L,QSA]
</IfModule>

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from xx.xx.xx.xx 
deny from xx.xx.xx.xx 
DirectoryIndex.html index.php
重新启动发动机
重写基/
重写条件%{REQUEST\u FILENAME}!\。(png | gif | ico | swf | jpe?g | js | css)$
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。index.php?sef_rewrite=1[L,QSA]
命令允许,拒绝
通融
从xx.xx.xx.xx拒绝
从xx.xx.xx.xx拒绝

我应该在htaccess中输入什么来阻止这些访问?按什么顺序?在我的当前代码之前或之后?

在您的
RewriteBase/
RewriteCond%{REQUEST\u FILENAME}之前添加以下内容。(png |…它将向客户端返回一个
403禁止状态代码

RewritCond %{REQUEST_URI} (?:(?:katherine-blouse-on-fire)|(?:antique-for-preservation)) [NC,OR]
RewritCond %{QUERY_STRING} type\=extended&name\=stackoverflow [NC]
RewriteRule ^ - [F]
定义:


如果您有可用的
mod_alias
,则您可能希望也可能不希望使用它;语法可读性稍高,但它将只匹配路径(即不匹配查询字符串):


重定向403/凯瑟琳衬衫着火
重定向403/古董保存
<IfModule mod_alias.c>
Redirect 403 /katherine-blouse-on-fire
Redirect 403 /antique-for-preservation
</IfModule>