URL redirect
URL redirect
I have what I hope is an easy question...
We would like to have our home page, when someone types it in WITHOUT the www in front, resolve to the www version, but, without the default.aspx at the end.
So example:
in address bar, type... poolgeek.com
should resolve to: www.poolgeek.com
Right now, the address resolves to www.poolgeek.com/default.aspx. Because it is a different URL, google will see the non-www address and the www address differently, thus splitting SEO strength of the home page.
Would anyone know of anyway to resolve this? I've tried multiple able commerce site, and all of them appear to have this problem.
Thanks for helping with this!
Scott
We would like to have our home page, when someone types it in WITHOUT the www in front, resolve to the www version, but, without the default.aspx at the end.
So example:
in address bar, type... poolgeek.com
should resolve to: www.poolgeek.com
Right now, the address resolves to www.poolgeek.com/default.aspx. Because it is a different URL, google will see the non-www address and the www address differently, thus splitting SEO strength of the home page.
Would anyone know of anyway to resolve this? I've tried multiple able commerce site, and all of them appear to have this problem.
Thanks for helping with this!
Scott
Re: URL redirect
With google webmasters you can setup your domain to be with or with out the www's
http://www.google.com/webmasters/ This should prevent any problems with SEO
http://www.google.com/webmasters/ This should prevent any problems with SEO
Re: URL redirect
Not what I'm talking about...
I undertand about google and webmaster tools.
I just need to have poolgeek.com resolve to www.poolgeek.com, not www.poolgeek.com/default.aspx.
Any ideas?
I undertand about google and webmaster tools.
I just need to have poolgeek.com resolve to www.poolgeek.com, not www.poolgeek.com/default.aspx.
Any ideas?
Re: URL redirect
Mazhar, any ideas on this? If I need to make changes to the source, I can do that. I'm just not sure exactly where to look.
Thanks
Scott
Thanks
Scott
Re: URL redirect
Scott I am not sure but it seems that its due to redirection imposed by our licensing module. When some one types domain name without www, I mean poolgeek.com then application redirects it http://www.poolgeek.com/Default.aspx. So I don't think so that you can fix it via code, have a look IIS redirection may be it workout. I will discuss it with Logan as well.
Re: URL redirect
Thanks for the help, Mazhar! I appreciate your taking the time to help me out with this. I will look at the IIS redirection and see if I can come up with anything in the meantime.
Thanks again.
Scott
Thanks again.
Scott
Re: URL redirect
You could probably fix this in reverse.
Redirect www.URL.com to www.URL.com/default.aspx
That way Google will see them as the same URL.
Redirect www.URL.com to www.URL.com/default.aspx
That way Google will see them as the same URL.
Re: URL redirect
Sorry the solution I posted is not right. It caused issues for me with products on my homepage
Last edited by TTMedia on Thu May 13, 2010 12:19 pm, edited 1 time in total.
-
- Lieutenant (LT)
- Posts: 70
- Joined: Fri Jan 15, 2010 8:17 am
Re: URL redirect
Might be able to fix it with a HTTP Module.
Then, add to your web.config:
Make sure and do some hefty testing tho. If there are any other redirects in place, you might end up in an infinite loop.
Code: Select all
using System;
using System.Web;
/// <summary>
/// Summary description for RedirectURL
/// </summary>
public class RedirectURL : IHttpModule
{
void IHttpModule.Dispose()
{
// Nothing to dispose;
}
void IHttpModule.Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
if (app.Request.RawUrl.ToLower().Contains("poolgeek.com/default.aspx"))
{
app.Response.Redirect("www.poolgeek.com", true);
}
}
}
Code: Select all
<httpModules>
<add name="RedirectURL" type="RedirectURL" />
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="AbleCommerceHttpModule" type="CommerceBuilder.Services.AbleCommerceHttpModule, CommerceBuilder.Services" />
</httpModules>
Make sure and do some hefty testing tho. If there are any other redirects in place, you might end up in an infinite loop.
-
- Lieutenant (LT)
- Posts: 70
- Joined: Fri Jan 15, 2010 8:17 am
Re: URL redirect
Did you get this fixed? What did you end up doing?
Re: URL redirect
A possible workaround for SEO purpose could be to add canonical URL to default page for search engine. For example you can edit Website/Default.aspx.cs file and locate following code line
and then update it as below
This will automatically add canonical URL to default page pointing to your domain name.
Code: Select all
<%@ Register Assembly="CommerceBuilder.Web" Namespace="CommerceBuilder.Web.UI.WebControls.WebParts" TagPrefix="cb" %>
Code: Select all
<%@ Register Assembly="CommerceBuilder.Web" Namespace="CommerceBuilder.Web.UI.WebControls.WebParts" TagPrefix="cb" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder htmlHead = new StringBuilder();
Uri storeUri = new Uri(Token.Instance.Store.StoreUrl);
string canonicalFormat = "<link rel=\"canonical\" href=\"{0}\" />";
string objectUrl = storeUri.Scheme + "://" + storeUri.Authority + Page.ResolveUrl("~/");
htmlHead.Append(string.Format(canonicalFormat, objectUrl));
Page.Header.Controls.Add(new LiteralControl(htmlHead.ToString()));
}
</script>
- AlexG
- Commander (CMDR)
- Posts: 128
- Joined: Mon Mar 03, 2008 9:51 pm
- Location: StealDeals.com
- Contact:
Re: URL redirect
I've added that code but it's not working on my side.
Re: URL redirect
This code changes the canonical URL which is hidden information on page. You will still see Default.aspx in address bar but it will emit your domain name in page HTML as canonical URL. If there is some canonical URL present in page HTML then search engine uses that link to index that page.
- AlexG
- Commander (CMDR)
- Posts: 128
- Joined: Mon Mar 03, 2008 9:51 pm
- Location: StealDeals.com
- Contact:
Re: URL redirect
I try to Fetch the page withuot WWW (http://mysite.com) as Googlebot and find out that page redirect (301 Moved Permanently) to http://www.mysite.com:80/default.aspx - but I need that returned the page http://www.mysite.com:80 without default.aspx - the same with HTTPS.
Help me to fix it PLEASE!
Thanks,
Alex
Help me to fix it PLEASE!
Thanks,
Alex
- AlexG
- Commander (CMDR)
- Posts: 128
- Joined: Mon Mar 03, 2008 9:51 pm
- Location: StealDeals.com
- Contact:
Re: URL redirect
Does anybody know how to fix it?
Re: URL redirect
Hi Alex,
If the site is running on your own dedicated server you can setup http://www.poolgeek.com and poolgeek.com as separate sites in IIS. The site under http://www.poolgeek.com will
be the main site pointing to the AbleCommerce applicaiton, the second site under poolgeek.com will have only a default.aspx page with simple 301 redirect code:
With this setup all requests sent to : http://poolgeek.com will be automatically forwarded to http://www.poolgeek.com. The 301 redirect is also CEO friendly and will be properly recognized by all SE.
If the site is running on your own dedicated server you can setup http://www.poolgeek.com and poolgeek.com as separate sites in IIS. The site under http://www.poolgeek.com will
be the main site pointing to the AbleCommerce applicaiton, the second site under poolgeek.com will have only a default.aspx page with simple 301 redirect code:
Code: Select all
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "http://www.poolgeek.com");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="PageForm" runat="server"></form>
</body>
</html>
Mike Kolev
- AlexG
- Commander (CMDR)
- Posts: 128
- Joined: Mon Mar 03, 2008 9:51 pm
- Location: StealDeals.com
- Contact:
Re: URL redirect
I open http://poolgeek.com - return me http://www.poolgeek.com/default.aspx !?
mikek wrote:Hi Alex,
If the site is running on your own dedicated server you can setup http://www.poolgeek.com and poolgeek.com as separate sites in IIS. The site under http://www.poolgeek.com will
be the main site pointing to the AbleCommerce applicaiton, the second site under poolgeek.com will have only a default.aspx page with simple 301 redirect code:
With this setup all requests sent to : http://poolgeek.com will be automatically forwarded to http://www.poolgeek.com. The 301 redirect is also CEO friendly and will be properly recognized by all SE.Code: Select all
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", "http://www.poolgeek.com"); } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="PageForm" runat="server"></form> </body> </html>
Re: URL redirect
Hi Mazhar,
I have two questions. Well the first is related to the code below.
1) I don't see a Default.aspx.cs file. Did you mean just the Default.aspx file?
They have me 3 times for my home page.
/
/default.aspx and
/Default.aspx
I can't believe Google can't distinguish uppercase and lowercase (so it seems).
2) What code could I use to add the canonical reference to other pages I created such as ContactUs.aspx? I tried the same code but it only listed my domain name url and not the ContactUs.aspx part.
All my duplicate content they have listed are pages like
contactus.aspx
ContactUs.aspx
Thank you very much!
I have two questions. Well the first is related to the code below.
1) I don't see a Default.aspx.cs file. Did you mean just the Default.aspx file?
Google Webmaster Tools is hitting me with duplicate content again, which is how I found your post. My URLs in their index went from over 2500 to 625.mazhar wrote:A possible workaround for SEO purpose could be to add canonical URL to default page for search engine. For example you can edit Website/Default.aspx.cs file and locate following code line
They have me 3 times for my home page.
/
/default.aspx and
/Default.aspx
I can't believe Google can't distinguish uppercase and lowercase (so it seems).
2) What code could I use to add the canonical reference to other pages I created such as ContactUs.aspx? I tried the same code but it only listed my domain name url and not the ContactUs.aspx part.
All my duplicate content they have listed are pages like
contactus.aspx
ContactUs.aspx
Thank you very much!
AC 7.0.3 build 13937