Canonical Question: / VS. /default.aspx

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
MaryP
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 43
Joined: Wed Oct 22, 2014 10:20 am

Canonical Question: / VS. /default.aspx

Post by MaryP » Tue Apr 26, 2016 4:40 am

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

MaryP
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 43
Joined: Wed Oct 22, 2014 10:20 am

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

Post by MaryP » Tue Apr 26, 2016 4:41 am

Also we are using AbleCommerce Gold R8 (build 7345)

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 258
Joined: Tue Jul 31, 2012 7:23 pm

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

Post by nadeem » Wed Apr 27, 2016 4:13 am

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.

MaryP
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 43
Joined: Wed Oct 22, 2014 10:20 am

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

Post by MaryP » Wed Apr 27, 2016 9:56 am

Excellent, this worked perfectly thank you!

Post Reply