The developer of a site (not our main site which was done in-house) redirects when you enter just domainname.com to domainname.com/Default.asp but when you enter www.domainname.com it shows just fine.
Because the site has content that changes on the homepage Google has picked this up as two separate pages and depending which they're using - the rankings are pages apart (page one vs. page 4 - big difference). How can I redirect the page when Default.aspx
loads (which now has links pointing to it) to to point to http://www.domainname.com/.
I've asked a few developers and noone seems to be able to supply a solution that actually works.
Hope you can help !
aspxredirectDefault
Chris
Metro Hi Speed internet fax services for businesses large and small.
First, your site is behaving normally, povided you have Default.aspx as your default document in IIS. Check your DNS and make sure domainname.com (blank host) points to the IP of your server. In reality, domainname.com and
www.domainname.com should point to th same page and Google will rank it as such. If you need to change it, you want a 301 redirect (Google it).
One is that before publishing you should set the default.aspx as startup page. This will make sure that the page accessed at start is the main default.aspx page.
If problem persists then you shold add a check in page_load event like below
If HttpContext.Current.Request.Url.toString().indexOf("http://") < 0 then
metrofax
Member
2 Points
8 Posts
Redirect default.aspx to /
Sep 28, 2008 10:46 PM|LINK
The developer of a site (not our main site which was done in-house) redirects when you enter just domainname.com to domainname.com/Default.asp but when you enter www.domainname.com it shows just fine.
Because the site has content that changes on the homepage Google has picked this up as two separate pages and depending which they're using - the rankings are pages apart (page one vs. page 4 - big difference). How can I redirect the page when Default.aspx loads (which now has links pointing to it) to to point to http://www.domainname.com/.
I've asked a few developers and noone seems to be able to supply a solution that actually works.
Hope you can help !
aspx redirect Default
Metro Hi Speed internet fax services for businesses large and small.
jeff@zina.co...
All-Star
87677 Points
11637 Posts
Moderator
Re: Redirect default.aspx to /
Sep 29, 2008 01:49 AM|LINK
First, your site is behaving normally, povided you have Default.aspx as your default document in IIS. Check your DNS and make sure domainname.com (blank host) points to the IP of your server. In reality, domainname.com and www.domainname.com should point to th same page and Google will rank it as such. If you need to change it, you want a 301 redirect (Google it).
Jeff
steppppo
Participant
780 Points
158 Posts
Re: Redirect default.aspx to /
Sep 29, 2008 01:52 AM|LINK
hi chris,
can you use a 301 redirect?
in the default.aspx page, put this:
hope this helps.
harrifer
Contributor
3233 Points
527 Posts
Re: Redirect default.aspx to /
Sep 29, 2008 02:05 AM|LINK
for 301 redirect here is some information:
http://www.webconfs.com/how-to-redirect-a-webpage.php
http://www.aspcode.net/ASPNET-301-redirect.aspx
hope it helps...
AliSufyanBut...
Contributor
2169 Points
626 Posts
Re: Redirect default.aspx to /
Sep 29, 2008 04:00 AM|LINK
Hi,
Two things to cross check before doing this.
One is that before publishing you should set the default.aspx as startup page. This will make sure that the page accessed at start is the main default.aspx page.
If problem persists then you shold add a check in page_load event like below
If HttpContext.Current.Request.Url.toString().indexOf("http://") < 0 then
response.redirect(http://www.domainname.com)
end if
Hope this helps
Best Regards
Ali Sufyan Butt
Sr.Software Engineer
Talented Earth Organization
deesh1531982
Contributor
4766 Points
823 Posts
Re: Redirect default.aspx to /
Sep 29, 2008 05:00 AM|LINK
if you want to redirect user from default.aspx you can do like this
<
head runat="server"> <title>Untitled Page</title><%Response.Redirect(
"yourdomain.com")%></
head>metrofax
Member
2 Points
8 Posts
Re: Redirect default.aspx to /
Sep 30, 2008 07:59 PM|LINK
I'll be testing the solutions later this week. I'll let you know what solutions works.
THANKS !!!
301 catchall
Metro Hi Speed internet fax services for businesses large and small.
metrofax
Member
2 Points
8 Posts
Why doesn't this work?
Oct 07, 2008 09:56 PM|LINK
Alright - I tried (with advice) the following code:
<script runat="server">
if(HttpContext.Current.Request.Url.AbsolutePath.ToLower == "/default.aspx")
{
HttpContext.Current.Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.domainname.com/" <http://www.domainname.com/> );
}
</script>
Any thoughts on why this didn't work?
Thanks !!!
301 redirect default.aspx
Metro Hi Speed internet fax services for businesses large and small.