homepage Welcome to WebmasterWorld Guest from 54.161.220.160
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

    
IIS 301 index.aspx to rootdomain.com
Is it possible to 301 redirect index.aspx to rootdomain.com
omarpeppy

5+ Year Member



 
Msg#: 3939263 posted 6:22 am on Jun 24, 2009 (gmt 0)

Is it possible to 301 redirect index.aspx to rootdomain.com? I know that when you try to 301 index.aspx you create an infinite loop.

I've tried searching in Google and webmaster world but haven't found a definite solution. We have full control of the IIS server so any help on 301 redirecting our index page to the root domain would be awesome. Thanks.

 

marcel

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3939263 posted 8:33 am on Jun 24, 2009 (gmt 0)

Are you running IIS7? If so you can use the URL rewrite module [learn.iis.net] with the following in your web.config:

<rule name="Default Document" stopProcessing="true">
<match url="(.*)index.aspx"/>
<action type="Redirect" url="{R:1}" redirectType="Permanent"/>
</rule>

Otherwise you could consider making default.aspx the default document and adding this to your index.aspx

private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.website.com/");
}

(this does have the disadvantage that now you have the same problem with default.aspx as you just had with index.aspx, but if index.aspx has already been indexed by Google for instance, then this should help correct that)

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