Page 1 of 1

Canonical Question: / VS. /default.aspx

Posted: Tue Apr 26, 2016 4:40 am
by MaryP
Hi all,

The canonical tag on our homepage is currently pointing at "/default.aspx". The way it is now, it’s telling Google that "hotsaucedepot.com" is not the real version of the homepage and that instead they should be indexing "hotsaucedepot.com/default.aspx," a page with no links pointing at it and no authority.

Then "default.aspx" is 301 redirecting to "hotsaucedepot.com" which tells search engines not to index that page either. This creates a recursive loop that can confuse search engines.

We want to leave the 301 redirect in place because we don’t want "/default.aspx" to be indexed, but we need to update the canonical tag to hotsaucedepot.com instead of "/default.aspx". How do we do this?

Thank you so much!
Mary

Re: Canonical Question: / VS. /default.aspx

Posted: Tue Apr 26, 2016 4:41 am
by MaryP
Also we are using AbleCommerce Gold R8 (build 7345)

Re: Canonical Question: / VS. /default.aspx

Posted: Wed Apr 27, 2016 4:13 am
by nadeem
This can be achieved by using bit of a code. Open Website/App_Code/PageHelper.cs, locate the following code inside BindMetaTags function:

Code: Select all

objectUrl = objectUrl.Replace("/mobile/", "/");
and replace with:

Code: Select all

objectUrl = objectUrl.Replace("/mobile/", "/");
string defaultPage = string.Format("{0}default.aspx", storeUri);
if (objectUrl.ToLowerInvariant().Equals(defaultPage))
    objectUrl = objectUrl.ToLowerInvariant().Replace("/default.aspx", "/");
This should update the canonical link as you want.

Re: Canonical Question: / VS. /default.aspx

Posted: Wed Apr 27, 2016 9:56 am
by MaryP
Excellent, this worked perfectly thank you!