Redirecting old URLs to new URLs

Jul 21, 2010 at 6:15 PM

I wanted to create an extension that I could redirect old URLs to new URLs. Sorry for the lack of details but I'm at work and I had just a few minutes to post this. I will give more details later.


Old URL:

New URL:


Bobby Cannon

Jul 22, 2010 at 11:10 AM

If the Old URL is an actual BE post or page, then you can create an extension that subscribes to the Post.Serving or Page.Serving events.  When the event occurs, you can check the URL, and do a 301 or 302 redirect to the new URL (if needed).  An example extension you could start off with (as a starting point) is the existing BreakPost extension in the App_Code\Extensions folder.

If the Old URL is not an existing BE post or page, then you probably won't be able to use an Extension since a Serving event for Pages or Posts won't fire.  In this case, you could create an HTTP module, or use the Global.asax file to create an event handler.  If you Google for "global.asax beginrequest", you'll see plenty of examples that handle each request to the server.  In your own BeginRequest event handler (in global.asax), you can check the URL, and redirect if necessary.

Sep 15, 2010 at 7:27 PM

You may check the FREE extension offered by SpiceLogic that allows you to manage a list of Old URL -> New URL mapper from your Admin Panel, and finally issue 301 Permanent Redirect when an Old Url is called. Here is the link :