I'm using the IIS Rewrite Module to take care of the migration between blogs so that no links are broken in the process. So I'm really just using a lot of 301 redirects.
However, I'd like to avoid redirects when possible for performance and SEO reasons. I can do this by duplicating my rules in code. But I thought I'd ask first. Is there a way to reuse the rules for the rewrite module to preprocess and reformat links?
The following is an excerpt from the blog theme...
<a rel="bookmark" href="<%=Post.PermaLink %>" title="<%=Server.HtmlEncode(Post.Title) %>">Permalink</a>
I'd like to change this to something like href="ReformatLink(Post.PermaLink)"
, where ReformatLink
runs the url rewrite rules on the specified URL and returns the new URL.
I found another way. I can create exactly the link format I want by modifying BlogEngine.Core. Inside Post.cs I simply change the properties
PermaLink
andRelativeLink
to reflect the link structure of the old blog software.I'll leave my rewrite module rules in place for now, in case I've missed something. But this seems to take care of the problem.