Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best DotNetNuke url rewriting approach?

I would like to implement a URL rewrriter for DotNetNuke. Have questions as to whether this is a good or possible approach and any suggestions other developers may have.

Can I add a dynamic or static route for URL rewriter from the 'Pages'-> 'Add Page' section?

Let's say I'm creating a page called 'Events' underneath the 'Activities' menu item.

Can I write some custom code in DotNetNuke that will add a prompt on the add page screen that assumes I will want a static or dynamic route added for - site.com/Activities/Events Or if I name the page 'Event Calendar' then it would suggest 'site.com/Activities/Event-Calendar'?

I would like any feedback or suggestions on how I would accomplish this! Thank you.

like image 510
user53885 Avatar asked Feb 12 '09 05:02

user53885


2 Answers

If you're using DotNetNuke 4.8 or greater, you just need to enable Human Friendly Urls through the Web.Config.

To enable human friendly urls, replace:

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

with:

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

UPDATE: For DNN 7.x and greater, this should now be:

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

Additional Detail: Enable Human Friendly Urls in DotNetNuke

like image 164
EfficionDave Avatar answered Sep 16 '22 12:09

EfficionDave


Check this out - details here:

http://www.ifinity.com.au/Blog/Technical_Blog/EntryId/19/Rewriting-the-DotNetNuke-Url-Rewriter-Module/

Also, take a look at the existing FriendlyUrl module that's already included in DNN.

If you want to do this on the stock pages, you'll need to crack open the source for it, or write a module that does this independently.

like image 36
Brandon Avatar answered Sep 17 '22 12:09

Brandon