1、当Asp程序根目录不存在web.config文件,或者配置文件内容为如下代码时:可以直接将面板生成的代码复制到伪静态/web_config/rewrite.config,保存即可。
?xml version="1.0" ?> <configuration> <location allowOverride="false" inheritInChildApplications="false" path="."> <system.webServer> <rewrite> <rules configSource="web_config\rewrite.config"></rules> </rewrite> <defaultDocument configSource="web_config\default.config"></defaultDocument> <httpErrors configSource="web_config\httpErrors.config"></httpErrors> <handlers configSource="web_config\php.config"></handlers> </system.webServer> </location> </configuration>示例:test01.wnana.com 301跳转到 test01.wnana.com
<?xml version="1.0" ?> <rules> <rule name="1645586406920_redirect" stopProcessing="true"> <match url="(.*)"/> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^test01.wnana.com"/> </conditions> <action type="Redirect" redirectType="Permanent" url="http://test02.wnana.com"/> </rule> </rules>重启/重载IIS后重定向生效
如原配置为以下格式:
注意2:如果【图1】中不存在<system.webServer>/<rewrite>/<rules>,则需要手动添加,下图为手动添加【<system.webServer>/<rewrite>/<rules>】