2

Hi guys am creating a product catalogue module for dotnetnuke 7. For the sake of functionality, when the user selects an item it goes to a product details page and appends the url with an id number for that item so the page knows what product to load, fairly standard functionality. My client, however, would like to have user friendly urls so instead going to www.domain.com/product.aspx?id=123 the user can www.domain.com/productname.

I have enabled user friendly urls in the host settings and am wandering if there is a method for adding to this list directly through code when the site admin adds an item to the catalogue so they don't then have to add it to the list separately in the host settings. Just to streamline the process a little. I would guess the list is stored in a table in the database somewhere but can't find it.

Any ideas?

HuwD
  • 1,800
  • 4
  • 27
  • 58

2 Answers2

1

This would typically be done through additional URL providers in the URL Master tools for DNN. URL Master is integrated into DotNetNuke 7.1 (releasing soon) so you'll probably just want to wait for that release and build a provider using those tools.

Chris Hammond
  • 8,873
  • 1
  • 26
  • 34
  • Kinda need to do this before the end of the month. Surely these are just stored in a table in the database somewhere and I can just connect the conventional way and update the table. – HuwD Jul 09 '13 at 15:42
  • You would think so, but they aren't. 7.1 just released today – Chris Hammond Jul 09 '13 at 16:26
0

Ideally, if it's your own module, you'll implement the ability to use meaningful URL names instead of IDs directly in the module.

If it's not your module, or you want even friendlier URLs than that, you can implement a URL Provider that is specific to the module. This will allow you to remove the page name from the URL, and make sure that URLs which are generated match URLs where you end up (which you don't get with simple rewrite mapping), among other benefits.

However, the simplest approach is probably to do what you're asking, and directly add URLs to the list of Friendly URL mappings. These mappings are stored in an XML file in the root of the website, SiteUrls.config. You should probably take a look at the code for the Host Settings module, to see if there's a good API for managing that file, or if it's direct file/XML manipulation.

bdukes
  • 152,002
  • 23
  • 148
  • 175