Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

How to show the world you don’t “get the web”

Pete Brown - 09 July 2012

So, I got this in my mailbox, entered in to the "contact me" form on my site:

image

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:

image

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.

   
posted by Pete Brown on Monday, July 9, 2012
filed under:    

17 comments for “How to show the world you don’t “get the web””

  1. jeffa00says:
    Kind sir or madam.

    I am hardly working for Dell since I am coming to this grand country on a 301 visa.

    Hardly am I sending emails to kind sirs or madams such as yourself kindly regarding internet "addresses" that have changed upon the lovely Dell web home.

    Why would you be wishing the robots without the souls or children or wives or pets to take away my job and snatch the foods and gaming consoles from the mouths, hands or paws variously of my wife and children and pets?

    I tried to get 404 visa, but I could not find the application.

    Please in future to remember that poor souls such as myself are hardly at work guiding your requests to the proper pages unless they do not exist and then we are sending you much emails to kindly ask that your are re-writing your lovely web home to point to our new beautiful pages.

    I ask you to forgive my English as I am not very good at it despite it being my native language. I am very frightened that in my classes I did not pay the attention when the teacher would bring forth the lessons on how to write the English. In fact I am quite frightened that instead I was reading the lovely web home of various animals such as the humorous cats and walruses.

    I hope this is 200 with you and you will 202 my kind regards.
  2. Stefan Thoolensays:
    Hey Pete!

    Nice article, funny to see that such a big company doesn't know how to deal with things.
    But I also want to add a small detail ;-)

    Although you are completely right about the HTTP redirection headers, I can understand why they would like you to change the link as well. Search engines determine the value of a page by a lot of criteria. One of them is the amount of other sites linking to that specific page.
    A HTTP redirect doesn't count as much as a direct link, which makes sense to me. So if a company has the resources to kindly ask webmasters to change the hyperlinks, it's not such a bad thing to do so.

    But to at least preserve a bit of weight on a website for SEO, it's recommended to (and I should say: must) add redirects on the old urls as well.

    So if I were Dell and I had all their resources available, I would start two seperate initiatives:
    1. send a default mail to webmasters who link to old pages
    2. redirect old pages to new ones
  3. DaveWillsays:
    Pete,

    Don't 301 redirects just handle the situation temporarily until the URL is updated? At some point 301 work has to be retired on the server side or it would become overwhelming to carry forward year after year. Ultimately the original link has to be updated and for static web type content links that happens how?

    Dave
  4. Petesays:
    @pg no doubt. I and others get on folks about that all the time.

    @DaveWill
    That may have been the intention when the web was much smaller and sites didn't have a million pages. The reality is, you can't ever count on the referring site being changed. People are going to link to your stuff, and they'll do it from static content, email, twitter, link shorteners and more. Especially in cases like Dell's, where there was some big one-time migration, the 301s don't compound year after year in any impactful way. Heck, if they had used friendlier URLs from the start, they could handle all the mapping transparently.

    In Google alone, there are almost half a million references to that now defunct product page (not for the specific product, but the product page itself).

    Pete
  5. Petesays:
    Actually, this may not be quite as hideous a problem as I thought it was.

    It looks like what Dell did was stop listing the old product (which is annoying, especially when you need support), and just wanted me to point to a monitor category page. This is something they certainly could have done themselves, but it's not the migration issue I thought it was.

    My comments and advice still stand, but the scale of the issue is much smaller :)

    Pete
  6. Samsays:
    I work at a public university, and we took a great deal of time to be sure our redirects were mapped correctly during a recent redesign. I guess we are in the minority.
  7. Ovesays:
    @stefan Where do you have it from that a 301 redirect does not carry through the SEO link juice as a direct link? If this is true, it kind of changes the equation a little bit. I've been completely fine with just using redirects til now, but if it loses link juice, this is an issue.

    @DaveWill 301 is a permanent redirect. 302 is a temporary redirect.
  8. Clintsays:
    having worked with large businesses before (including Dell), I am willing to bet this is a case of the IT team not working well with the SEO/marketing team. I'd bet $100 this is due to the SEO team not having control of redirects, and putting in requests to IT take longer than asking referring websites to change their links. It is a sad problem in many large businesses. Maybe their management will see this and work on the system.
  9. DaveWillsays:
    @Pete
    I still have trouble asking a corporation to spend money managing redirects when they don't get any say in who can keep an old link that they then need to maintain. Of course Dell spending resources to contact each entity using an old link is also something I don't get.

    Maybe this is an opportunity for Bing to provide a 301 mapping lookup. For a given old link return the current link. Then maybe the Bing Webmaster tools could provide a listing of outdated links on a site and provide the appropriate current link to use.
  10. Spammesays:
    Pete: "Heck, if they had used friendlier URLs from the start, they could handle all the mapping transparently."

    Uh, as a MS fanatic I wouldn't say such things, since when MS use user friendly urls? Since when the big form-view-state-postback-thing aka asp.net can handle user friendly urls? MS people tend to forget very fast the very bad things that they have done in internet to just point the finger against somebody and yelling: "You don't use user friendly urls!"
  11. Petesays:
    @Spamme

    You don't need to fear using your name here. It's cool, really.

    I didn't write the ASP.NET code, and also never defended the giant-list-of-parameters approach. I'm free to critique, even if I do work at MS. :)

    Keep in mind that ASP.NET has supported relatively friendly URLs and URL rewriting for some time. True it was more work up front and didn't get easier until MVC timeframe. But, by far, MS wasn't the only one using ugly URLs. Ever look at what was generated from Java-based sites? With all the @@@@@@@ and other random symbols? Uuuuugly.

    @DaveWill

    Search-engine based 301 redirects is interesting. Not sure how it could be managed in a way that's not simply easier for a site to do on their side, thoguh.

    Pete
  12. Spammesays:
    Pete: "Ever look at what was generated from Java-based sites?"

    Again pointing the finger against somebody and yelling: "He did the same!", really childish! Mature people can assume responsibility!
  13. Petesays:
    @Spamme

    Really wish you'd use your real name.

    Microsoft can take responsibility for things like viewstate, but ASP.NET URLs have been able to be pretty for a very long time. A quick search came up with this MSDN article from 2004 that shows one way to do it:
    http://msdn.microsoft.com/en-us/library/ms972974.aspx

    So not sure what we should be assuming responsibility for here. Also, not sure why you're being so condescending about this.

    Pete
  14. Stefan Thoolensays:
    Sorry to kick up such an old thread, but I didn't realized I got a question fired at me ;-)

    @Ove:
    I work at an internet company, which has a SEO department. I pointed them to this article, and they told me. But a more relyable source would be:
    http://www.marketingpilgrim.com/2010/03/google-confirms-301-redirects-result-in-pagerank-loss.html

Comment on this Post

Remember me