Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
.htaccess 重写Cond HTTP_REFERER以允许自己的站点作为url参数并阻止其他url_.htaccess_Mod Rewrite_Wordpress - Fatal编程技术网

.htaccess 重写Cond HTTP_REFERER以允许自己的站点作为url参数并阻止其他url

.htaccess 重写Cond HTTP_REFERER以允许自己的站点作为url参数并阻止其他url,.htaccess,mod-rewrite,wordpress,.htaccess,Mod Rewrite,Wordpress,我希望在我的一些页面中接收自己站点的url作为$\u GET参数,但不希望任何其他url在任何网页上作为$\u GET参数传递。为此,请使用.htaccess代码以及此处提到的其他一些措施: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{QUERY_STRING} \.\.\/ [NC,OR] RewriteCond %{QUERY_STRING} ^.*\.(bash|git|hg|log|svn|swp|cvs)

我希望在我的一些页面中接收自己站点的url作为$\u GET参数,但不希望任何其他url在任何网页上作为$\u GET参数传递。为此,请使用.htaccess代码以及此处提到的其他一些措施:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{QUERY_STRING} \.\.\/ [NC,OR]
RewriteCond %{QUERY_STRING} ^.*\.(bash|git|hg|log|svn|swp|cvs) [NC,OR]
RewriteCond %{QUERY_STRING} etc/passwd [NC,OR]
RewriteCond %{QUERY_STRING} boot\.ini [NC,OR]
RewriteCond %{QUERY_STRING} ftp\:  [NC,OR]
RewriteCond %{QUERY_STRING} http\:  [NC,OR]
RewriteCond %{QUERY_STRING} https\:  [NC,OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>|ê|"|;|\?|\*|=$).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(&#x22;|&#x27;|&#x3C;|&#x3E;|&#x5C;|&#x7B;|&#x7C;).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(127\.0).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(request|select|concat|insert|union|declare).* [NC]
RewriteCond %{QUERY_STRING} !^loggedout=true
RewriteCond %{QUERY_STRING} !^action=rp
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
RewriteCond %{HTTP_REFERER} !^http://maps\.googleapis\.com(.*)$
RewriteCond %{HTTP_REFERER} !^http://mysite\.com(.*)$
RewriteRule ^(.*)$ - [F,L]

</IfModule>
在结尾的第三行,如果我试图将我网站的任何url作为GET参数传递到我的任何网页中,比如包括http ex:'http://mysite\.com”,它返回403错误

以下是我尝试以GET参数访问网站url的方式:

"http://mysite\.com/abc_页面?url=http://mysite\.com/efg_页'

请告诉我上面的代码有什么问题。该代码实际上是由Word Press Better Security插件添加的,我添加了RewriteCond%{HTTP_REFERER}^http://mysite\.com.*$允许我自己的网站的url

“\”添加在.com之前,因为stackoverflow不允许使用mysite.com名称放置在主体内部

RewriteCond %{HTTP_REFERER} !^http://mysite\.com(.*)$