【发布时间】:2016-02-01 08:55:21
【问题描述】:
我的 apppot.com 代理正在报废我的网站,并且有一些页面被 Google 索引,这意味着一些重复的内容问题。我从我的网站以及 AppEngine-Google 成功阻止了 appspot.com 域,但问题是当通过 appspot.com 访问我的网站时,我收到以下消息:
禁止
您无权访问此服务器上的 /。
此外,在尝试使用 ErrorDocument 处理请求时遇到 500 Internal Server Error 错误。
我已经在 htaccess 中指定了 403 错误文件。这是阻止appspot.com的代码部分
我的问题是如何让我的错误页面显示而不是显示此消息。
谢谢
ErrorDocument 403 /403-forbidden.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC]
RewriteRule ^(.*)$ - [F,L]
RewriteCond %{QUERY_STRING} \.\.\/ [NC,OR]
RewriteCond %{QUERY_STRING} boot\.ini [NC,OR]
RewriteCond %{QUERY_STRING} tag\= [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} ^.*("|'|<|>|\|{||).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F|127\.0).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(request|select|insert|union|declare).* [NC]
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
RewriteRule ^(.*)$ - [F,L]
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{ENV:HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} AppEngine-Google [NC]
RewriteRule .* - [F]
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} AppEngine-Google [NC]
RewriteRule .* http://zone-series.net [L,R=301]
RewriteCond %{HTTP_REFERER} http://jasmeet-js.appspot.com/
RewriteCond %{HTTP_USER_AGENT} AppEngine-Google\s~jasmeet-js
RewriteRule .? /403-forbidden.html [L]
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} AppEngine-Google [NC]
RewriteRule .* - [F]
RewriteEngine on
RewriteCond %{HTTP_REFERER} appspot.com [NC]
RewriteRule .* - [F]
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Sogou
RewriteRule ^.*$ - [F]
BrowserMatchNoCase AppEngine-Google bad_bot
Order Deny,Allow
Deny from env=bad_bot
<Files 403-forbidden.html>
order allow,deny
allow from all
</Files>
【问题讨论】:
-
鉴于您不能在 google-app-engine 上使用 apache,您到底在问什么?您是否正在运行 apache 服务器并希望阻止来自 GAE 实例的传入请求?
-
不,我正在使用 VPS 服务器,并且我已经成功阻止了 appengine,但是当我访问例如 xxx.appspot.com/mydomain.com 时,我在尝试访问 403-forbidden 时遇到 500 错误。 .html 文件。当有人通过 appspot.com 访问我的网站时,我想显示 403-forbidden.html 页面
-
嗯,错误表明在尝试显示 ErrorDocument 指向的文档时发生了内部错误。显而易见的开始是查看您的 Apache 错误日志以查看它记录的内容。我猜它可能会尝试禁止显示 /403-forbidden.html 作为该错误的 ErrorDocument 的一部分,
-
是的,这就是问题所在,但如何允许显示 403-forbidden.html
标签: .htaccess google-app-engine http-status-code-403