Welcome to WebmasterWorld Guest from 54.147.134.218

Forum Moderators: ocean10000

Message Too Old, No Replies

IIS 301 index.aspx to rootdomain.com

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

     
6:22 am on Jun 24, 2009 (gmt 0)

New User

5+ Year Member

joined:Mar 17, 2009
posts: 6
votes: 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.

8:33 am on June 24, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 1, 2005
posts:732
votes: 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)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members