赞
踩
在 ASP.NET项目里,在web.config文件里配置一些转发相关的内容的话,项目部署到IIS中之后,就能够看到iis的一些变化。
如下图:
当然,我们也可以在IIS的重定向里面使用图形化操作方式配置,配置完成之后保存,web.config文件里也会产生变化。
有些时候想要特别指定一些地址重定向、SEO方面的内容,就可能会很有用了,甚至可能是w唯一办法。
这里备份一下,没有别的什么意义。
<system.web> <customErrors mode="Off" /> <compilation debug="true" targetFramework="4.6.1" /> <httpRuntime targetFramework="4.5.2" /> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <httpRedirect enabled="false" destination="http://debug.www.mysite.cn/Release.html" exactDestination="true" childOnly="true" /> <httpErrors> <remove statusCode="500" subStatusCode="-1" /> <remove statusCode="404" subStatusCode="-1" /> </httpErrors> <rewrite> <rules> <clear /> <rule name="/quanbu-quanbu" stopProcessing="true"> <match url="^([a-z1-9]+)/([a-z1-9]+)/(\S+)-quanbu$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Redirect" url="{R:1}/{R:2}/{R:3}" /> </rule> <rule name="重写规则1 对于 /quanbu" stopProcessing="true"> <match url="^([a-z1-9]+)/([a-z1-9]+)/quanbu$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Redirect" url="{R:1}/{R:2}" appendQueryString="false" /> </rule> <rule name="RemoveTrailingSlashRule2" stopProcessing="true"> <match url="^([a-z1-9]+)/([a-z1-9]+)/(news-\d{1,})/$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> </conditions> <action type="Redirect" url="{R:1}/{R:2}/{R:3}" /> </rule> <rule name="RemoveTrailingSlashRule1" stopProcessing="true"> <match url="^([a-z1-9]+)/([a-z1-9]+)/([a-z-]*quanbu)/$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> </conditions> <action type="Redirect" url="{R:1}/{R:2}/{R:3}" /> </rule> <rule name="AddTrailingSlashRule2" stopProcessing="true"> <match url="^([a-z1-9]+)/([a-z1-9]+)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> </conditions> <action type="Redirect" url="{R:1}/{R:2}/" /> </rule> <rule name="AddTrailingSlashRule1" stopProcessing="true"> <match url="^([a-z1-9]+)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> </conditions> <action type="Redirect" url="{R:1}/" /> </rule> <rule name="CanonicalHostNameRule1" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^test-www\.mysite\.cn$" negate="true" /> </conditions> <action type="Redirect" url="https://test-www.mysite.cn/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> <runtime> </runtime>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。