Simple 301 redirects for small MVC 3 websites

  • 0
  • March 13, 2012
Julian Kay

Julian Kay

Developer

We recently did an upgrade for a small web app which went from the older ASP.NET Web Forms technology to the latest ASP.NET MVC 3 framework.

When we do redirects on new .NET websites, we tend to use the IIS URL Rewrite plugin, but because this site was not using the latest version of IIS we decided to make a simple redirection controller inside the application.

This suited us just fine, as the application didn’t have too many indexed pages anyway.

Here’s how to do it:

Create yourself a Controller dedicated to handling redirections

Add routes for your legacy URLs

For small websites where the IIS URL Rewrite plugin isn’t an option, this is an easy way to please Google with 301 redirections from old URLs to new ones.

If you’d like any more information or advice on this, feel free to drop us a line!

Free of charge. Unsubscribe anytime.