Search code examples
iis-7url-rewritingoutbound

Is it bad practice to rely on outbound rules for rewriting?


For the past few years, if I've wanted a URL of a page on a site rewritten I've put the rewritten URL into the link on the page.

E.g. If the page is /Product.aspx?filename=ProductA and it's rewritten to /Product/ProductA.aspx then I've put the following in my link:

<a href="/Product/ProductA.aspx">...</a>

However, with outbound rules I could just put the links in to the actual file paths, and rewrite with an outbound rule.

Is this a bad method? Would it cost the server unnessacery additional resources?


Solution

  • I would not consider this bad practice. Infact it affords you some additional flexibility as your mapping for friendly to real url's is all managed in one central location. If your seo team decide they want to change the url scheme, you dont have to pick through all the links on your site updating them- risking missing one!

    One important limitation of the current version of the IIS rewrite module, is you cannot use outbound rewriting in conjunction with Static compression- However you can still use Dynamic compression. Static compression is nice because it will cache the compressed version of the page. See this article for instructions on getting url rewrite working with Dynamic compression: http://forums.iis.net/p/1165899/1950572.aspx