iFinity Blogs 

New Custom Url Provider creates Friendly Urls for the DotNetNuke Blog Module

by Bruce Chapman on Wednesday, October 26, 2011 3:03 PM

With the release of Url Master 2.5, there is now the opportunity to publish custom Url providers for different DotNetNuke modules.

The first module provider to be released is the DotNetNuke Blog Module provider.

This provider allows an administrator to completely change the way that the standard DotNetNuke Blog Module Urls appear.

This is achieved by installing the provider as a DotNetNuke Extension, then configuring it through the new ‘Providers’ tab in the Url Master portal administration page.

What the provider does

Fundamentally the provider inserts a layer between the Url that gets requested and the Blog Module itself, and another layer to the generation of Urls for display on the output Html page.  Of course, all existing DNN installations already have a Url Rewriting layer between the Urls and the underlying modules, but this has always been a closed box to the module developer.  The module developer has never had full control over the Urls for their module – until now, that is.

Here’s the changes:

Blog Entry Url :

Old Style  with no Url Master or Blog Module Url Provider :


New Style with Url Master 2.5 and Blog Module Url Provider  :


Blog Url :

Old Style - http://www.ifinity.com.au/Blog/TabId/65/BlogId/2/Default.aspx

New style - http://www.ifinity.com.au/Blog/Crafty_Code

Archive Url :

Old style - http://www.ifinity.com.au/Blog/TabId/65/BlogDate/2011-10-01/DateType/Month/default.aspx

New style - http://www.ifinity.com.au/archive/2011/10

All of the ‘old’ style Urls are also redirected to the new style urls, through the third layer that the Module Url Provider has – which is the ability to intercept and redirect Urls.

NOTE: The above Urls use ‘_’ as a space replacement character.  This is because, on this site, the Url Master module is configured to use the _ character to replace spaces.  The module provider simply picks up this option and uses it in the replacement.  On sites with a ‘-‘ as the space replacement character, the Urls would include ‘-‘.  Incidentally, this applies to all the Url Master options, including diacritic characters and the new custom character replacement feature.

How to Change your Blog Urls

Step 1 : Download and Install the Url Master 2.5 installation package.  If you’ve got a live site without an existing Url Master installation, stop by and get a free trial licence as well.

Step 2 : Download the Blog Module Provider 01.00 Install package from the Url Master downloads page

Step 3 : Install the Blog Module Provider extension into your DotNetNuke install, using the DotNetNuke extensions page.

NOTE: The Blog Module Url Provider requires minimum DNN version 5.1 and Blog version 3.5

Step 4 : Navigate to the Admin->Portal Urls page, and click on the ‘Module Providers’ tab.

Step 5 : Click on the ‘Change Provider Settings’ link for the ‘DotNetNuke Blog Module Friendly Url Provider’ entry, and set the options you wish to use:


There is help boxes next to each of the entries, to help decide what to use.  You can specify the path for Urls, whether to show the DNN page in the Url (http://example.com/BlogPage/2011/10/01/blog-entry)  or http://example.com/2011/10/01/blog-entry) and whether to change all blog entry Urls, or just the ones after a particular Entry Id.  When finished, click on ‘Apply Changes’ and then ‘Return to Providers’ which will return you to the Module Providers tab of the Portal Urls page.

Step 6 : Check the ‘Use this provider’ box listed next to the listing.

Step 7 : Highlight the page your blog module is on in the page list to the left, then, as you hover over the entry listing, click the >> button to associate that page with your provider.  This restricts the calls to the Blog Module provider only for the pages that you select.  You can select multiple pages if you have multiple blog modules in your site.

Step 8 : Click the ‘Apply Changes’ button, and return to your Blog page on your site.

Step 9 : Go to the Blog Module Options page, and click on the ‘Regenerate Permalinks’ button.

NOTE: If you’re already using the Url Master module for your site, and your Blog Urls don’t already have the /TabId/xx pattern in them, you’ll need to first clear out the old permalinks before regenerating them.  Please see this blog post for more information : Regenerating DotNetNuke Blog Permalinks when changing to Friendly Urls

Step 10 : Test out your new blog Urls!

How does it work?

The Blog Module Provider is a separate install to the Url Master module, and it also creates an entry in the web.config file, under a new section called ‘moduleFriendlyUrl’.

The provider is a compiled program, which is called by the Url Master module after reading the web.config file to learn the name and type of the provider.

There are three main parts to the provider, rewriting, redirecting and friendly Url generation.  I have discussed these three parts of DotNetNuke Friendly Urls before in the blog post Understanding DotNetNuke Friendly Urls and Url Rewriting.

The provider simply responds to the 3 Url Master calls with Urls determined from the blog-module specific logic.

Source code for the Blog Module Provider is available from http://www.ifinity.com.au/Products/Free_Downloads

Can I build my own provider for my own module?

Of course!  The entire design is extensible to allow extra implementation of module-specific providers.  This allows module developers to completely break free of the DotNetNuke imposed Url design.  You don’t have to have the page name, the tabid, or anything else in your Url.  Just get the domain name right, and you can do whatever you like with the rest.  The only restrictions are your imagination as a module developer.

Have you Implemented this Provider yet?

If you install this on your blog and start using it, please let me know via the comments and leave a link to your blog.  Any and all feedback is most welcome.  For support requests, please post on the Url Master module forum.

Blogs Parent Separator Crafty Code
Bruce Chapman

The craft of writing code. The outcomes from being crafty with code. Crafty Code is tales from the coding bench.

3 comment(s) so far...

Anonymous 10/30/2011

I upgraded my blog and all seems to work fine.<br /><br /><a href="http://www.woax-it.at/News/BlogId/1.aspx" rel="nofollow">www.woax-it.at/News/BlogId/1.aspx</a><br /><br /><br />very good module<br /><br />regards

Anonymous 11/2/2011

I cannot contain my self upon hearing this.... <br /><br />Let me just say: AAAAWWWWWWW YYYYEEEAAAHHHH!<br /><br />Thank you!

Bruce Chapman 11/2/2011

@woax - great to see it working for you<br />@nelson - certainly one of the more spirited comments I've had!

Bruce Chapman
Hi, I'm Bruce Chapman, and this is my blog. You'll find lots of information here - my thoughts about business and the internet, technical information, things I'm working on and the odd strange post or two.
Connect with Bruce Chapman on Google+

Share this page
Get more!
Subscribe to the Mailing List
Email Address:
First Name:
Last Name:
You will be sent a confirmation upon subscription

Follow me on Twitter
Stack Exchange
profile for Bruce Chapman at Stack Overflow, Q&A for professional and enthusiast programmers
Klout Profile