IIS配置web.config 将带www域名转为不带www域名
在configuration节点中添加
<configuration> <system.webServer> <rewrite> <rules> <!--http转https--> <rule name="Redirect to https" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}:443/{R:1}" redirectType="SeeOther" /> </rule> <!--将带www转为不带www--> <rule name="WWW Redirect" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^www.xxx.com$"/> </conditions> <action type="Redirect" url="https://xxx.com/{R:0}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>