要實(shí)現(xiàn)IIS上的這種域名重定向,你可以使用URL重寫(xiě)模塊來(lái)配置重定向規(guī)則。以下是一個(gè)基本的web.config配置示例,它實(shí)現(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://www.ykjd9.com/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
建站咨詢(xún)熱線(xiàn)
029-33273980