Welcome to WebmasterWorld Guest from 54.160.131.144

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

     

omarpeppy

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

5+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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)