Asp.net IIS 7.5 URL重写模块是否重新格式化链接?

Asp.net IIS 7.5 URL重写模块是否重新格式化链接?,asp.net,iis-7.5,blogengine.net,url-rewrite-module,Asp.net,Iis 7.5,Blogengine.net,Url Rewrite Module,我正在使用IIS重写模块来处理博客之间的迁移,以便在迁移过程中不会断开链接。所以我只是使用了很多301重定向 然而,出于性能和SEO原因,我希望尽可能避免重定向。我可以通过在代码中复制规则来实现这一点。但我想我应该先问一下。有没有办法重用重写模块的规则来预处理和重新格式化链接 以下是博客主题的摘录 <a rel="bookmark" href="<%=Post.PermaLink %>" title="<%=Server.HtmlEncode(Post.Title) %&

我正在使用IIS重写模块来处理博客之间的迁移,以便在迁移过程中不会断开链接。所以我只是使用了很多301重定向

然而,出于性能和SEO原因,我希望尽可能避免重定向。我可以通过在代码中复制规则来实现这一点。但我想我应该先问一下。有没有办法重用重写模块的规则来预处理和重新格式化链接

以下是博客主题的摘录

<a rel="bookmark" href="<%=Post.PermaLink %>" title="<%=Server.HtmlEncode(Post.Title) %>">Permalink</a>


我想将此更改为类似于
href=“ReformatLink(Post.PermaLink)”
,其中
ReformatLink
对指定的url运行url重写规则并返回新的url。

我找到了另一种方法。我可以通过修改BlogEngine.Core创建我想要的链接格式。在Post.cs中,我只需更改属性
PermaLink
RelativeLink
,以反映旧博客软件的链接结构

我会暂时保留我的重写模块规则,以防我遗漏了什么。但这似乎解决了这个问题。

我正在使用这个库,我正在做下面的事情

    <rule name="FolderAndNoQueryString" stopProcessing="true">
      <match url="^([^/]+)/([^/]+)/?$" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <!--  The following condition prevents rule from rewriting requests to .axd files -->
        <add input="{URL}" negate="true" pattern="\.axd$" />
      </conditions>
      <action type="Rewrite" url="{R:1}/{R:2}.aspx" />
    </rule>

ApplicationPath只是一个普通的Web.Config键,如下所示

<add key="ApplicationPath" value="/MyVirtualDir/" />

<add key="ApplicationPath" value="/MyVirtualDir/" />