Welcome to WebmasterWorld Guest from 54.226.194.180

Forum Moderators: ocean10000

Message Too Old, No Replies

Detecting index.asp in server variables

     

Numpty

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

10+ Year Member



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

blend27

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

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



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.

dataguy

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

WebmasterWorld Senior Member 10+ Year Member



Try Request.ServerVariables("SCRIPT_NAME"), this should give you '/index.asp' and then you can 301 '/'.

carguy84

5:20 am on May 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That will put you into an infinite redirect.

Numpty

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

10+ Year Member



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.

defanjos

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

WebmasterWorld Senior Member 10+ Year Member



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.

jaytee

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

5+ Year Member



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.

Panic_Man

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

10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month