Home
  |   Login

Creating DotNetNuke Friendly Urls

Mar 24

Written by:
3/24/2010 6:52 PM  RssIcon

For a long time I have always used the Globals.NavigateUrl() method in DotNetNuke to create links in my custom modules.  I have recently converted to using the FriendlyUrl provider in DotNetNuke.  The big advantage for me was to create a custom page url for SEO purposes without hacking the DNN framework.  I wanted to get rid of the standard Default.aspx and also create urls that were more SEO friendly.


Using the Friendly Url provider is very simple.  Simply pass the tab, tab url path, and custom page name.


Example 1:
DotNetNuke.Services.Url.FriendlyUrl.FriendlyUrlProvider.Instance().FriendlyUrl(TabInfo tab, string path, string pageName);


Example 2:
DotNetNuke.Services.Url.FriendlyUrl.FriendlyUrlProvider.Instance().FriendlyUrl(new TabController().GetTab(_tabId), "~/Default.aspx?tabid=" + _tabId "&Parameter1=xyz", "My_Custom_Page_Name.aspx");


This will result in the following url:

http://localhost/Tab_Page_Title/tabid/1/Parameter1/xyz/My_Custom_Page_Name.aspx


This now gives us a nice SEO url!!!  If we didnt use the DNN FriendlyUrl provider then our url would look something like this:

http://localhost/tabid/1/Parameter1/xyz/Default.aspx


You can see that there are no useful keywords there for the search engine to pick up!!


Note:  In order for this to work, you need to have "HumanFriendly" urls enabled in your web.config file for your dnn installation.


<friendlyUrl defaultProvider="DNNFriendlyUrl">
            <providers>
                <clear />
                <add name="DNNFriendlyUrl" type="DotNetNuke.Services.Url.FriendlyUrl.DNNFriendlyUrlProvider, DotNetNuke.HttpModules" includePageName="true" regexMatch="[^a-zA-Z0-9 _-]" urlFormat="humanfriendly" />
            providers>
        friendlyUrl>



1 comment(s) so far...


Gravatar

Re: Creating DotNetNuke Friendly Urls

Thanks for these ideas about creating DotNetNuke friendly urls. They are of good use. Keep us updated with this please.

By High Search Engine Ranking Optimization on   10/18/2010 9:43 PM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 

Search

Minimize
Archive
<May 2012>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
Monthly
Go