homepage Welcome to WebmasterWorld Guest from 54.242.140.11
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Detecting index.asp in server variables
Numpty

10+ Year Member



 
Msg#: 3330965 posted 5:05 pm on May 4, 2007 (gmt 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

 

blend27

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3330965 posted 9:06 pm on May 4, 2007 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3330965 posted 10:56 pm on May 4, 2007 (gmt 0)

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

carguy84

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3330965 posted 5:20 am on May 7, 2007 (gmt 0)

That will put you into an infinite redirect.

Numpty

10+ Year Member



 
Msg#: 3330965 posted 4:15 pm on May 7, 2007 (gmt 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.

defanjos

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3330965 posted 4:27 pm on May 7, 2007 (gmt 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.

jaytee

5+ Year Member



 
Msg#: 3330965 posted 9:34 pm on May 25, 2007 (gmt 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.

Panic_Man

10+ Year Member



 
Msg#: 3330965 posted 9:31 pm on May 26, 2007 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved