2

I'm convinced there is a simple solution for this:

We have an ASP page that uses Ajax for users to browse content. Our problem is that when Google crawls our website it links its search results to the un-styled content pages. We want to be able to redirect traffic from the content pages to the styled page that is calling them. How do we accomplish this without sending the page into an infinite redirect loop?

We've considered other solutions to our problem but this is what we want to accomplish; redirecting our .ASP pages to the page where they are included without sending them into a loop. That is of course anyone has any suggestions that we haven't already considered.

I've wasted an entire day already trying to find a solution that works in ASP without any luck, I'll probably be spending all of tomorrow doing the same... Look forward to any advice, thanks.

4

1 に答える 1

2

Would help to see the code of course, or know the live URL but here goes...

I presume you already have code in place to do the redirect and you just need a system to know when to redirect and when not to?

A couple of suggestions:

  • Check the referrer in the content pages and if it is not your AJAX request then do the redirect (not sure if your AJAX code will fill the referrer, if it doesn't then do the redirect if there is a referrer as search engines will always have referrer)
  • Store a Session variable when the ASP page is called, and check that it exists in the content pages and if not do the redirect
  • Store a Cookie when the ASP page is called, and check that it exists in the content pages and if not do the redirect
  • Change your AJAX request to a form POST instead of GET, and in the content pages if not POST then do the redirect

EDIT: One thing I didn't think about was that search engines may not be able to crawl these pages if you use any of my suggestions so I would also suggest that you add a user agent check to allow crawlers

Having looked at your code I would add the following to the top of your ASP unstyled pages.

strAgents = "Google|msnbot|Rambler|Yahoo|AbachoBOT|accoona|AcioRobot|ASPSeek|CocoCrawler|Dumbot|FAST-WebCrawler|GeonaBot|Gigabot|Lycos|MSRBOT|Scooter|AltaVista|IDBot|eStyle|Scrubby"
arrAgents = Split(strAgents, "|")
blnAgent = False
For i = 0 to UBound(arrAgents)
    If InStr(Request.ServerVariables("HTTP_USER_AGENT"), arrAgents(i)) <> 0 Then
        blnAgent = True
        Exit For
    End If
Next

If Not blnAgent Then
    If Request.ServerVariables("HTTP_REFERER") <> "http://www.uleth.ca/lib/archives/timeline/" Then
        Response.Redirect("http://www.uleth.ca/lib/archives/timeline/#19xx?zoom_highlight=19xx")
    End If
End If
于 2012-09-26T11:47:45.250 に答える