Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

canonicalization problems

0 views
Skip to first unread message

Jeff

unread,
Mar 20, 2010, 5:54:17 PM3/20/10
to
hi

asp.net

I have some canonicalization problems with my site. I've just googled my
site using the oprator site and inurl:
site:mydomain.com -inurl:www
Which resulted in a list of links to my site which don't contain the www
link.

In Google Webmaster Tools I've specified preferred domain to be
www.mydomain.com, but I did this about yesterday. Do not think that change
have made any effect on the SERP yet.

In my Global.asax file I have this method:
void Application_BeginRequest(object sender, EventArgs e)
{
string requestedDomain =
HttpContext.Current.Request.Url.ToString().ToLower();

if (requestedDomain.IndexOf("http://domain.com") > 0)
{
requestedDomain = requestedDomain.Replace("http://domain.com",
"http://www.domain.com");
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", requestedDomain);
Response.End();
}
}

In the SERP I mentioned above (site:mydomain.com -inurl:www), if I click on
one of the links (this is links which do not contain www), then I'm taken to
my domain without www. So I suppose the Application_BeginRequest method has
something wrong or there are some other issues I haven't taken care of yet.

any suggestions?


Alexey Smirnov

unread,
Mar 24, 2010, 7:12:16 AM3/24/10
to
On Mar 20, 10:54 pm, "Jeff" <it_consulta...@hotmail.com.NOSPAM> wrote:
> hi
>
> asp.net
>
> I have some canonicalization problems with my site. I've just googled my
> site using the oprator site and inurl:
> site:mydomain.com -inurl:www
> Which resulted in a list of links to my site which don't contain the www
> link.
>
> In Google Webmaster Tools I've specified preferred domain to bewww.mydomain.com, but I did this about yesterday. Do not think that change

> have made any effect on the SERP yet.
>
> In my Global.asax file I have this method:
> void Application_BeginRequest(object sender, EventArgs e)
> {
>     string requestedDomain =
> HttpContext.Current.Request.Url.ToString().ToLower();
>
>     if (requestedDomain.IndexOf("http://domain.com") > 0)
>     {
>         requestedDomain = requestedDomain.Replace("http://domain.com",
> "http://www.domain.com");
>         Response.Clear();
>         Response.Status = "301 Moved Permanently";
>         Response.AddHeader("Location", requestedDomain);
>         Response.End();
>     }
>
> }
>
> In the SERP I mentioned above (site:mydomain.com -inurl:www), if I click on
> one of the links (this is links which do not contain www), then I'm taken to
> my domain without www. So I suppose the Application_BeginRequest method has
> something wrong or there are some other issues I haven't taken care of yet.
>
> any suggestions?

this

if (requestedDomain.IndexOf("http://domain.com") > 0)

is wrong because it has to be equal to 0

0 new messages