Url Rewriting

Modified on 2013/07/05 10:13 AM by brucerchapman Categorized as Uncategorized
When a page is requested it needs to have a unique identifier. Internally every page in DotNetNuke has a unique tabid (the terminology of "tab" rather than "page" is for historical reasons and cannot be changed now as it could break 3rd party modules). When no Url Rewriting is enabled pages are loaded based around this unique identifier, and have the form www.mysite.com/default.aspx?tabid=99 . In some cases pages or/and modules installed on them, utilise querystring variables, so the page url could look like www.mysite.com/default.aspx?tabid=99&somevariable=1

For some time DNN has supported the notion of URL rewriting. This is where the URL for a page appears to the user in one form, but internally is converted into it's traditional form.

To determine how to rewrite a URL, DNN reads the configuration via Provider definition. By doing it this different schemes can be switched in and out, allowing for url's in any form the site needs. The default installation of DNN supports 3 schemes -advanced, search friendly and human friendly URLs.

Advanced URLs were added in DNN 7.1 and greatly increase the functionality of URLs available. This includes simplified URLs for pages, ability to redirect to the Canonical URL, using different URLs for different languages, and more. All new DNN installs from 7.1 onwards use the advanced mode by default.

The second supported form of scheme is known as human friendly URLs, where the name of the DNN page is used as a "virtual" URL (if unique and valid). In this case, the page could look like www.mysite.com/home.aspx .

The third option is search friendly URLs. Using this scheme DNN uses a regex pattern in the siteurls.config file to match the URL against a pattern which includes the page name and the Tab Id. This means that a page called home with a traditional url of www.mysite.com/default.aspx?tabid=40 could look like www.mysite.com/tabid/home/tabid/40/default.aspx. The search friendly option was the first URL rewriting option available in earlier version of DNN and is retained for backward compatibility.

Enabling/Configuring»

There are three modes of Friendly URLs in DNN.

  • Advanced : all of the available functionality
  • HumanFriendly : uses simple URLs for Page names, but uses TabIds in more complicated URLs. Limited redirect support.
  • SearchFriendly : includes TabId patterns in URLs.

If you're running DNN 7.1 or later, you can activate the 'advanced' mode of Friendly Urls.

If you're using a version earlier than DNN 7.1 (from DNN 4.6 to DNN 7.0) you can only choose between friendly Url modes of 'searchfriendly' and 'humanfriendly'

If you're running a version prior to 4.8 you must login as a host (superuser) user, and go to host->host settings and ensure that the "Enable friendly urls" checkbox is checked.

To choose between the three modes, change the urlFormat attribute of the DNNFriendlyUrl provider declaration in the web.config file:

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

The options for urlFormat are:
  • "advanced"
  • "humanfriendly"
  • "searchfriendly"



Other options»

Due to the provider based model, there are a number of alternatives. Some of these can be read about here and others can be found at Snowcovered .


Copyright 2014 by DNN Corp Terms of Use Privacy
Request
a Demo
See Evoq Live
Latest Blog
How to Make Advocate Marketing Work for You
Read It
Watch the Replay
Top 5 Reasons to Consider a Branded Online Community
Watch