Do you use IIS7 Rewrite to fix ugly URLs?

Loading last updated info...

Ugly URLs don't only make it difficult for users to browse your site, they can also impact Google rankings.

northwind.com/MyInternalDB/UserDatabase/ProductList.aspx?productname=Access

❌ Figure: A nasty URL...

You should fix it up to look more like this:

northwind.com/products/access

✅ Figure: Users could even guess this nice URL

How to fix

  1. Add in Global.asax a route
protected void Application_Start(object sender, EventArgs e)
{
//RouteTable and PageRouteHandler are in System.Web.Routing
RouteTable.Routes.Add("ProductRoute", new Route("products/{productname}", new PageRouteHandler("~/MyInternalDB/UserDatabase/ProductList.aspx.aspx")));
}

😐 Figure: Figure: OK example - create a static route if you only have a few rewrites**

  1. Use the URL Rewriting Module for IIS7
Image

✅ Figure: Good example - An IIS7 Rewrite is much easier to manage

Authors

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star