So, I got this in my mailbox, entered in to the "contact me"
form on my site:
Dear Dell Web Team: Please learn to internet. The fact that you
emailed people (manually, as it's unlikely you scripted my contact
form) who linked to pages you've moved, makes me wonder how you've
made it this far. Did you also email someone at
Google/Bing/Yahoo/Ask/Excite/Lycos (blast from the past) to tell
them to update their search results?
Changing your URLs is not the same thing as ensuring our
content is "fresh and beneficial to our users". Chances
are, you changed your CMS or product catalog app, and didn't bother
to redirect the links. Ok, I understand, except that now you're
taking the effort to pester people who link to your site. Surely
that is not a good use of your time. How many hundreds of emails
did you send? No programmer would do that, they'd
write something to handle it automatically, at the source. I bet
Dell got some administrative types to sit there with a spreadsheet
of referrers, and a form letter. Wow. What a life.
You own the domain and the pages. It's completely within
your power (and responsibility) to handle the link update
yourself. Instead, here's how they decided to handle
it:
Too many companies treat web pages, even catalog pages, as
ephemeral things of the moment. That's just not how the Internet
works. If I link to a page on my blog, and it dead-ends on
your site a year later, you've missed an opportunity. If
you really don't want the page up anymore (I know, those old pages
make the hard drives weigh too much), you could have redirected the
page to your newest model, or to a page showing me a comparison of
other things that are related.
The people who are the worst about this are, unfortunately,
universities. A given web page on a university site, despite
possibly having great and relevant content, lasts just a couple
years before they shut down the account. Sad, really. I run into
this time and again while researching various things.
I don't claim to be perfect in this regard; I'm sure I have 404s
on my site. However, I have made an effort, and wouldn't put the
onus on others to fix their links. In fact, at one point, I even
redirected common typos on my site. There was some site out there
that had the URL for one of my pages misspelled. Rather then beg
them to fix it, I just redirected it to the correct page. It was
quick, and it was the easiest thing to do.
So, what should Dell do?
How to do it correctly
The "301 moved permanently" redirect is your friend
here. When I migrated my site from community server, as part of the
migration app I wrote, I created a big set of permanent redirects.
The original ugly community server URLs still work. Here, try
one:
http://community.irritatedvowel.com/blogs/pete_browns_blog/archive/2010/02/10/the-book-of-wpf.aspx
It 301 redirects you to
/blog/2010/02/10/the-book-of-wpf
See. I kept my content "fresh and beneficial" without
adding more pain to the end user.
There are lots of URL rewriting solutions out there. Most blog
engines and CMS have them built in. For performance reasons, I did
this huge redirect as a custom HttpModule in ASP.NET, with the URLs
hard-coded in a giant case statement. I generated the case
statement as part of the migration app I wrote. I had originally
written the app to generate the config-based redirect URLs, but
performance of that was terrible when you had 500-600 of them in
there.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PeteBrown.UmbracoCSRedirector
{
public class RedirectorModule : IHttpModule
{
#region IHttpModule Members
public void Dispose()
{ }
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
string originalTarget;
if (app.Request.Url.IsAbsoluteUri)
originalTarget = app.Request.Url.AbsolutePath.Trim().ToLower();
else
{
string newUri = app.Request.Url.ToString();
if (newUri.Contains('?'))
originalTarget = newUri.Split('?')[0].Trim().ToLower();
else
originalTarget = newUri.Trim().ToLower();
}
// optimization to make the string comparison quicker
originalTarget = originalTarget.Replace("/blogs/pete_browns_blog/archive", "P");
string newLocation = string.Empty;
// I'm doing a giant switch here because I gen the code and code is likely
// to be faster than a lookup table. Need all the speed I can get.
switch (originalTarget)
{
case "P/2005/08/19/appraisals-and-home-renovations.aspx":
newLocation = "/blog/2005/08/19/appraisals-and-home-renovations";
break;
...
case "P/2010/02/10/the-book-of-wpf.aspx":
newLocation = "/blog/2010/02/10/the-book-of-wpf";
break;
...
// redirects from www.irritatedvowel.com main site
case "/programming/standards.aspx":
newLocation = "/articles/net-naming-conventions-and-programming-standards---best-practices";
break;
default:
break;
}
if (string.IsNullOrEmpty(newLocation))
{
// clean up all the domains that alias this one
if (app.Request.Url.IsAbsoluteUri)
{
if (app.Request.Url.Authority != "10rem.net" && app.Request.Url.Authority != "192.168.1.55")
{
newLocation = "" + app.Request.Url.PathAndQuery;
}
}
else
{
// not absolute, so should be good to go
}
}
// redirect if we have a new url
if (!string.IsNullOrEmpty(newLocation))
{
app.Response.StatusCode = 301;
app.Response.AppendHeader("Location", newLocation);
}
}
#endregion
}
}
I'm not claiming this code is perfect or the best solution, but
it is certainly better than begging people to update their links.
As an added bonus, it works :)
So, let's stop breaking the internet. Creating redirects as part
of a migration is a fairly easy thing to do. Even if you have
thousands (or hundreds of thousands) of entries, there are
efficient ways to handle it.