Back to all posts

Canonical Portal Alias Woes DNN 5.6.2

Posted on Sep 07, 2011

Posted in category:
Development
DNN

One of the additions to DotNetNuke 5.x (not sure when/where) was the ability for DotNetNuke to provide a Canonical URL in the meta-information for your page. When this all works well, things are going perfectly. You can configure the site to use the Canonical URL via the "Admin Settings" page and normally all works well, but I had a very "interesting" issue with a site recently and I thought I'd share in case anyone else had a similar issue.

The Back Story

To be sure that everyone knows just how this problem came about I'll give you a little history on the site. It was one that I built in the same manner that I do for most of my sites when I'm replacing an existing site. A temporary domain name was used let us call it http://test.mysite.com, all content was then added here and the site was eventually switched over to mysite.com and went live.

When I did the switch over I did all of the things that you normally do, I deleted the portal alias that was reflecting the test.mysite.com domain and everything looked perfect!

The Issue

Now fast forward about one month, when this issue was actually identified. We had pages where Facebook "Like" buttons were added. For some reason, these buttons were not working they would throw an error, similar to "site http://test.mysite.com/.... responded with a 404". Now, how the heck did it have this? I deleted the portal alias, I had the proper alias set as the "default" for the portal and everything. There was nothing visibly wrong with the portal. Looking at the source of the page, you could spot the Canonical tag noting the test.mysite.com domain? How was it getting this value?

The Fix

I'll admit, I didn't dig into the core code of DNN, but I found a "fix" for the issue. Go to "Admin Settings" and simply click "Update". The second I did this the site updated, all Canonical Url's updated and all of my Facebook "Like" buttons started working. Now, I'm working now to see if I can re-create this issue and if I can I'm going to log it as a bug in the core, but if you see something funny with your site, you might just try clicking that "update" button! It can do some good!

Hope this helped!