Permanent 301 Redirect from http:// to http://www.

Discussion in 'Microsoft Development' started by tomfloate, Mar 1, 2010.

  1. tomfloate

    tomfloate Perch

  2. Stephen

    Stephen US Operations Staff Member

    This really has to be done in code, as to Hsphere they are the same.
  3. tomfloate

    tomfloate Perch

    Thanks Steven.

    Thought that might be the case ... I will do some googling.
  4. tomfloate

    tomfloate Perch

    Hi all ... having had a look around I cant find anything that quite suits the need so wondered if anybody here had a decent way of doing this?

    I can obviously do this

    :Response.Status = "301 Moved Permanently"
    Response.AddHeader("Location", "/your-new-url/")
    Response.End()


    But how do I check to see if they have come from www. or not?
  5. tomfloate

    tomfloate Perch

  6. Manish

    Manish Bass

    Sorry but we don't offer ISAPI_Rewite on shared server. You can install it on VPS server.
  7. tomfloate

    tomfloate Perch

    cheers manish
  8. tomfloate

    tomfloate Perch

    In a Global.asax file should Application_BeginRequest fire? Or is that somehow disabled?
  9. Stephen

    Stephen US Operations Staff Member

    that works fine, ISAPI addons are not installed due to a major way in which it makes logs have errors.
  10. tomfloate

    tomfloate Perch

    Cheers Steven. I found a good solution to work around so thanks.
  11. cdog

    cdog Perch

    I recently came across a solution where static websites on windows servers can essentially have a redirect for a non www domain to their www domain thats treated as a 301 redirect by the serach engines. I'm yet to test it but thought I'd share it here, I found it on Matt Cutts blog (google man)
    just google 'canonical links'

    I figure its a good option for sites with no .htaccess file or the option to add additional headers server side. I'd be interested to know if anyone has tried this approach yet.
  12. tomfloate

    tomfloate Perch

    On another note does anybody know how to redirect default.aspx to the root ie.

    http://www.testdomain.com/default.aspx to http://www.testdomain.com/ . I have tried interrogtating both

    Request.ServerVariables("URL")
    and
    Request.RawUrl

    and both always contain default.aspx so checking and redirecting causes and infinite loop??(
  13. tomfloate

    tomfloate Perch

    could I use the redirect part of hsphere??
  14. Manish

    Manish Bass

    In place of setting redirect on default.aspx, why don't you add default.aspx as directory index ?

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services