1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

301 redirect using ASP

Discussion in 'C#' started by maleeha.baig, Feb 2, 2011.

  1. #1
    Dear dp members, It's been 3 days night and day been figuring out what to do. We have a website we did a 301 redirect it was done just fine. It was showing 2 home pages 1 was

    1. www.
    and non www.

    we wanted to route it too www. (due to higher links coming in)


    now the website displays as http://www.decor-collection.com/index.aspx

    we want display only http://www.decor-collection.com

    please help, we can't understand it's going too /index.aspx we were told it could be server setting or default. If anyone is an expert in asp sites we would greatly appreciate it.

    thank you!
     
    maleeha.baig, Feb 2, 2011 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    An option, that is simple though not the worlds most efficient would be to use your Global.asax file:

    
    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
            Dim Domain As String = "www.decor-collection.com"
            If Not Request.Url.Host.Equals(Domain, StringComparison.InvariantCultureIgnoreCase) Then
                         Response.Clear()
                         If Request.Url.PathAndQuery.Contains("index.aspx") Then
                              Response.RedirectLocation = String.Format("{0}://{1}", Request.Url.Scheme, Domain)
                         Else
                              Response.RedirectLocation = String.Format("{0}://{1}{2}", Request.Url.Scheme, Domain, Request.Url.PathAndQuery)
                         End If
                         Response.StatusCode = 301
                         Response.End()
            End If
    End Sub
    
    
    
    Code (markup):
     
    AstarothSolutions, Feb 3, 2011 IP
  3. longcall911

    longcall911 Peon

    Messages:
    1,672
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Your web host provider gives you a control panel of some sort and this control panel will let set which extensions for the site's home page are allowed. The base filenames are either default or index. The standard extensions are htm, html, asp, and so on. Check to be sure that *.aspx is listed. If it is not, add it.
     
    longcall911, Feb 3, 2011 IP