Tilak Bisht

SEO Consultant & WordPress Web Designer

301 Redirecting From /default.aspx To The Site Root on IIS

July 21, 2010 By Tilak

Mostly websites are configured to serve the same content for www.domain.com; domain.com and www.domain.com/default.aspx (or index.html, index.asp, index.aspx). All three URLs will reach to same page of content. It could hurt your ranking in Google and other search engines because they will be indexed as three separate Urls. Google calls this process to “canonicalization”.

You may check out (using the Google Toolbar) the PageRank (PR) for www.domain.com, domain.com and www.domain.com/default.aspx – you will not get the same PR of all three URLs.

For resolve this issue you have to implement a 301 redirect from non-www version to www version or vice versa. For Apache server you can do 301 redirect via .htaccess easily and for IIS server you do also 301 redirect via web.config as well.

How to resolve default.aspx redirect problem?

1- always use http://www.domain.com instead of www.domain.com/default.aspx anywhere in your site, whether you are using absolute or relative links.

2- Put the javascript based redirect on your default.aspx page. This script will automaticall redirect to root folder of the site. Below is the simple javascript, which you put in your /default.aspx page:

<script type=”text/javascript”><!–
var u = ‘http://www.domain.com/’;
if (self.parent.frames.length != 0) self.parent.location=u;
if (self.location != u) self.location=u;
//–></script>

Technically search engines robots don’t process a client-based redirect, but if the /default.aspx URL never show in the address bar, then it should never get bookmarked or linked by anyone else.

 

UPDATE (8th September 2010):
My colleague (Mr. Anoop) has also sent me another java script which also redirect default.aspx to root and it is working fine.

<script type=”text/javascript”>
var url=location.href;
if (url.toLowerCase().match(“default.aspx”)) {
location.href = url.toLowerCase().replace(“default.aspx”, “”);
}
</script>

Filed Under: Marketing

© 2025 Tilak Bisht. All Right Reserved.