azure web 应用程序上的 Wordpress 站点重定向到 404 错误页面
我在 Azure Web 应用程序中托管了一个基于 wordpress 的 Internet 站点.
I've a wordpress based internet site hosted within an Azure web app.
如果我在 URL 的/"后面输入各种字符串(例如:www.blabla.net/asdfasdf"),我将被重定向到我配置的 404 错误页面.但是: 如果 URL 字符串包含一个或多个+"字符(例如:www.blabla.net/as+asdf"或仅www.blabla.net/+")重定向到配置的 404 错误页面不起作用,我被重定向到包含以下文本的页面:
In case I enter a various string behind the "/" of my URL (for instance: "www.blabla.net/asdfasdf") I get redirected to my configured 404 Error page. BUT: In case the URL string contains one or multiple "+" characters (for instance: "www.blabla.net/as+asdf" or just "www.blabla.net/+") the redirection to the configured 404 Error page doesn't work and I get redirected to a page containing the following text:
您要查找的资源已被删除、更名或暂时不可用.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
我在 IIS 8 上的web.config"文件如下所示:
My "web.config" file on the IIS 8 looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress: http://blabla.net" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Redirect" url="index.php"/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration>
如果您能给我任何提示如何配置 web.config 文件,将+"字符视为其他各种字符,并且重定向到配置的 404 错误页面,我将不胜感激?
I would very appreciate it if you could give me any hint how to configure the web.config file in such a way that "+" characters are treated as the other various characters and the redirection is performed to the configured 404 Error page?
先谢谢你!
出于安全原因,包含双重转义序列的 URL 请求将被过滤模块拒绝,从 IIS 7 开始.这就是为什么您会收到 404.11 响应将+"字符放入 URL 时的代码.您可以参考这篇文章了解详情.
Due to security reasons, a URL request containing a double escape sequence will be rejected by the filtering module since IIS 7. That is why you have got a 404.11 Response code when you put a "+" character into the URL. You may refer to this post for the details.
如果您坚持使用带有+"字符的 URL 来工作,您可以使用下面列出的 web.config
文件.然后 www.blabla.net/as+asdf
或 www.blabla.net/+
将被重定向到配置的 404 错误页面,但请记住这可能以某种方式降低您网站的安全级别.
If you insist on making a URL with a "+" character to work, you can use the web.config
file as listed below. Then the www.blabla.net/as+asdf
or www.blabla.net/+
will be redirected to the configured 404 Error page, but keep in mind this may somehow reduce the security level to your website.
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
<rewrite>
<rules>
<rule name="WordPress: http://blabla.net" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>