The Mighty Blog

Updating DotNetNuke Blog Permalinks for URL Master

Feb 22

Written by:
2/22/2010  RssIcon

If you’re using the URL Master module from IFinity, chances are that you are also using the extension-less URL pattern like you see on my site.  This is a great way to shorten your URLs for a more SEO-friendly impact when search engine spiders crawl your site.  It also removes the TabID from the URL, which also has a meaningful impact on SEO – not to mention making the URLs more human-friendly.  This is sometimes more important than the SEO benefits.

By default, the DotNetNuke® Blog Module generates a URL that looks like the following URL:

http://www.domain.com/PageName/tabid/123/EntryID/123/Blog-Title.aspx

This isn’t a horrible URL structure, but it leaves plenty of room for improvement.  That pesky TabID needs to go.  This is done automatically by URL Master.  It also gets rid of the .aspx for you with a simple setting checkbox.  You really cannot get rid of the EntryID without modifying the Blog Module code.  You could get rid of the PageName too, but you might not even have to deal with it if your blog module lives on your home page.  For me, the optimal URL would look more like this:

http://www.domain.com/PageName/EntryID/123/Blog-Title

You may notice that I already have that done.  Well, URL Master made its job easy, but I still had the old URLs rendered in the mark-up of the blog module.  Meaning, when you hovered over the blog links, you saw the original URL format, and your web browser goes to that same URL when the link is clicked.  Luckily, URL Master will perform a 301 redirect, so the search engines are covered, but it would be even better for the search engines, and even better for your visitors who might create their own links to those blog links in your page.

How do we fix this?  My first instinct was to regenerate the permalinks in the blog module, in its Blog Settings.  This didn’t have the intended effect.  So, I resolved to having to manually update the permalinks.  It’s unbelievably simple to make this update.  You can do it in one query, but I have it broken down into two queries for illustration.

PLEASE NOTE: These updates have an irreversible effect on the database. It is suggested that you try this on a staging site first, and backup your database prior to executing these queries.

First, remove the TabID from the URL using this query (replace 123 with the appropriate tabid):

   1: UPDATE {databaseOwner}[{objectQualifier}Blog_Entries] 
   2: SET [PermaLink] = REPLACE([PermaLink],N'/tabid/123',N'');

Second, remove the .aspx extension using this query:

   1: UPDATE {databaseOwner}[{objectQualifier}Blog_Entries] 
   2: SET [PermaLink] = REPLACE([PermaLink],N'.aspx',N'');

If you want to see the effects you just had on the database, just run this query:

   1: SELECT [BlogID],[EntryID],[Title],[PermaLink]
   2: FROM [dbo].[Blog_Entries] 
   3: ORDER BY [EntryId] DESC;

I added the databaseOwner and objectQualifier tokens in the previous code snippets so that they could be run in the SQL Module.

That’s all there is to it.  Once your cache refreshes, all of your blog URLs should be rendered in the new SEO-friendly format.

Tags:
Categories: DotNetNuke

2 comment(s) so far...


Gravatar

Re: Updating DotNetNuke Blog Permalinks for URL Master

Will - can't you just use the 'regenerate permalinks' option in the blog configuration section? I'm pretty sure this will do the same job as what you did. It will also remove the /tabid/xx/ part of the Url from your urls if you have made blog posts prior to installing the Url Master software.

I updated all of my links when I did this, and I didn't write Sql to do it (though it would be just like me to dive straight into the database and start writing queries). It's worth trying it out, anyway.

By Bruce Chapman on   2/25/2010
Gravatar

Re: Updating DotNetNuke Blog Permalinks for URL Master

Unfortunately, I did try that, and monitored the database. The URLs didn't change for me for some reason. I didn't notice any errors come through about it either.

That being said, it is possible that I've changed something in the blog module in regards to it's URL generating. Mine is slightly modified, but I do not remember touching the URLs at all - but rather the page titles and bookmarklets.

By Will on   2/25/2010

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
Add to Technorati Favorites
Tweet about my blog
The opinions expressed here are the personal opinions of Will Strohl and do not necessarily represent the views and opinions of the DotNetNuke Corporation.
© Copyright 2004-2011 by Will Strohl. All rights reserved. Website Skinned By: Ralph Williams  Website Hosted By: Applied Innovations