秀站云的弹性云云服务器,针对win2008系统设置404和301会产生WEB.CONFIG文件,需要两个文件融合在一起。上篇文档我们介绍过了win2008设置404页面教程和win2008 IIS设置301重定向介绍。
今天就分享下404和301的整合,web.config 代码为:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="404.html" responseMode="File" />
</httpErrors>
<rewrite>
<rules>
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^xiuzhanyun.com$" />
</conditions>
<action type="Redirect" url="http://www.xiuzhanyun.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>