要實現(xiàn)IIS上的這種域名重定向,你可以使用URL重寫模塊來配置重定向規(guī)則。以下是一個基本的web.config配置示例,它實現(xiàn)了你的需求:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="301Redirect-1" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^wan-qi\.cn$" /> </conditions> <action type="Redirect" url="https://www.wan-qi/{R:0}" redirectType="Permanent" /> </rule> <rule name="Redirect to https" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" /> </conditions> <action type="Redirect" url="http://m.fjgmzy.com/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
建站咨詢熱線
029-33273980