Url重写通过测试但未重定向
我在我的iis中安装了URL重写模块2,我有这个规则Url重写通过测试但未重定向,url,url-rewriting,Url,Url Rewriting,我在我的iis中安装了URL重写模块2,我有这个规则 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="ASPX to ASP Redirect" stopProcessing="true">
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ASPX to ASP Redirect" stopProcessing="true">
<match url="([_0-9a-z-\.]+).com/([_0-9a-z-]+).aspx$" />
<action type="Redirect" url="http://{R:1}.com/{R:2}.asp" appendQueryString="true" logRewrittenUrl="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
基本上我想要的是创建匹配的东西,比如www.test.com/default.aspx,并将其重定向到它的asp版本,这样当我键入www.test.com/default.aspx时,它将重定向到www.test.com/default.asp
不确定这有什么问题。域名不是与正则表达式匹配的URL的一部分。域名是什么真的重要吗?我想说,只要URL以
.aspx
结尾,它就应该重定向到以.asp
结尾的同一页面。这很容易做到:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ASPX to ASP Redirect" stopProcessing="true">
<match url="(.*)\.aspx$" />
<action type="Redirect" url="/{R:1}.asp" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>