【发布时间】:2016-01-07 02:25:34
【问题描述】:
有时我的网站会将访问者重定向到我的错误页面“is_error.aspx” 当一些人打开主页或任何其他页面时,我的网站是 ASP.NET,我使用的是 windows server 2012
web.config 包含以下行:
<customErrors mode="On" defaultRedirect="/is_error.html">
<error statusCode="404" redirect="/is_error.html" />
</customErrors>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
<httpErrors errorMode="DetailedLocalOnly">
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/is_error.html" responseMode="ExecuteURL" />
<error statusCode="401" prefixLanguageFilePath="" path="/is_error.html" responseMode="ExecuteURL" />
<error statusCode="403" prefixLanguageFilePath="" path="/is_error.html" responseMode="ExecuteURL" />
<error statusCode="500" prefixLanguageFilePath="" path="/is_error.html" responseMode="ExecuteURL" />
</httpErrors>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.feee3\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.feee3.com/{R:1}" />
</rule>
<rule name="feee3Https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
“is_error.html”页面:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>feee3.com</title>
<script type="text/javascript">
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
</script>
</head>
<body onload="MM_goToURL('parent','is_error.aspx');return document.MM_returnValue">
</body>
</html>
我不知道将我的域重定向到“www”的问题 或将其重定向到“https”! 或者我可以用另一种方式在 web.config 中编写“重写”部分吗?所以在一行中它重定向到“www”和“https”?
【问题讨论】:
标签: url redirect web https web-config