Welcome to WebmasterWorld Guest from 54.162.151.77

Forum Moderators: ocean10000

Message Too Old, No Replies

Detecting index.asp in server variables

     
5:05 pm on May 4, 2007 (gmt 0)

New User

10+ Year Member

joined:Aug 29, 2003
posts:38
votes: 0


We are experiencing duplicate content issues in Google.

Basically, they are indexing www.mydomain.com/index.asp and also www.mydomain.com

I was going to use an asp script to redirect 'index.asp' to '/' based on the server variable 'URL', however I've found that using request.servervariables produces exactly the same results whether I use www.mydomain.com/index.asp or just www.mydomain.com

Anyone any ideas how I can flick www.mydomain.com/index.asp to www.mydomain.com?

Thanks in advance!

Al

9:06 pm on May 4, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2004
posts:1988
votes: 73


I've been looking for the answer to this for a while now, and I am not sure that it is achievable under IIS.

Unless I am totaly wrong and have not found the answer.

The trick you could do is set a different document as defalt page for root directory, and 301 index to it, but this is untill someone links to that new document, so no purpose there.

10:56 pm on May 4, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 12, 2004
posts:1355
votes: 0


Try Request.ServerVariables("SCRIPT_NAME"), this should give you '/index.asp' and then you can 301 '/'.
5:20 am on May 7, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2005
posts:1078
votes: 0


That will put you into an infinite redirect.
4:15 pm on May 7, 2007 (gmt 0)

New User

10+ Year Member

joined:Aug 29, 2003
posts: 38
votes: 0


carguy84 is right.

I tested Request.ServerVariables("SCRIPT_NAME")
It produces exactly the same response whether I type index.asp in the URL or not.

4:27 pm on May 7, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 12, 2002
posts:857
votes: 0


Anyone any ideas how I can flick www.mydomain.com/index.asp to www.mydomain.com?

Use isapi_rewrite
You can also 301 redirect mydomain.com to www.mydomain.com, plus many other neat things.

9:34 pm on May 25, 2007 (gmt 0)

New User

10+ Year Member

joined:Apr 18, 2006
posts:17
votes: 0


I posted a similar answer to another question earlier this evening. This assumes you are using VB/C#:-

You can do a lot in the Application_BeginRequest event in Global.asax.vb. You intercept specific pages using:-

LCase(Request.ServerVariables("SCRIPT_NAME")).ToString...

and then use:-

HttpContext.Current.Response....

and

Context.RewritePath

It is what Isapi filters do but within .NET itself.

9:31 pm on May 26, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 21, 2004
posts:60
votes: 0


Numpty, check my response on this thread:
[webmasterworld.com...]