Redirecting http://website.com to http://www.website.com (for SEO)

Discussion in 'ASP.NET 2.0' started by pinch, Jun 18, 2008.

  1. There is no IIS setting that can do this. What you want is for requests coming in through http://website.comto result in a 301 permanent redirect to http://www.website.com. You'll have to create some custom HTTP module that does the 301 permanent redirect. Are you on IIS6 or IIS7?

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  2. <STRIKE>Rick at West Wind developed an ASP.NET component that I was using here last year on IIS6.


    Update: It was Keyvan http://nayyeri.net/blog/remove-www-from-urls-in-asp-net/


    What it does is, from your web.config, strip out the www from every site url.
    Would that work for you?
    Salute,
    Mark




    Post Edited (wisemx) : 6/20/2008 4:20:41 PM GMT
     
  3. Isn't the convention to add the www to urls where it doesn't exist? I think that would be a better solution for me since almost all of my backlinks use the 'www'. That solution would work fine as long as it has the desired effect of concentrating PR on a single page rather than across 2.
     
  4. I thought it was Rick I got it from but it was actually Keyvan.
    Anyway, he did a good blog post about the concept.
    You can grab the code and /bin/ file from there too:
    http://nayyeri.net/blog/remove-www-from-urls-in-asp-net/

    I didn't have any trouble using it, with ASP.NET or Classic ASP, it worked great.
    Salute,
    Mark
     
  5. I'll give that a shot. Thanks.
     
  6. mjp

    mjp

    The WWW subdomain is not a technical requirement for DNS records or web servers. Itwas simply adopted into wide use in the early days of the web, and continues to persist for some reason. Maybe to make it harder to say your site name to someone. ;)

    So I don't know that there is a convention, so to speak, since there are no specific rules for using the subdomain. Many browsers though, will automatically try to prepend thewww if a host is not found at domain.com. On my personal sitesI direct all www.domain.com traffic to domain.com. But that's just a personal preference, and when I started doing that I saw absolutely no change in any Google listings, so I am skeptical that it makes any difference, SEO-wise. But I'm not an SEO expert, so take that with ashaker of salt.

    But I have to say that I have never understood why some companies - some very large companies - do notmaintain Arecords for domain.com, without the www subdomain. It might be "SEO-friendly" (does anyone really know for sure?),but in actual practice, it's not very smart.
     
  7. I believe I'm on II6. I have found a solution online; maybe you can tell me if this is viable. The idea is to handle the Application_BeginRequest event in the Global.asax file:

     

Share This Page