Products » Knowledge Base » Url Master 

Url Master Help Wiki

Modifying Advanced Regex Patterns

The Url Master module is able to be configured using a set of Regex patterns. Generally, these regex patterns control which parts of the module interact with which Urls. Mostly, they can be thought of a series of gates, with matching Urls stopped at the gate, and non-matching Urls let through.

All of the Regex Patterns are accessed by going to the 'Advanced Regex Settings' section on the Host->Friendly Url Settings page of a Url Master installation.

The regex patterns are not used to modify incoming Urls. They aren't a find/replace pattern to change or rewrite a Url, and generally will only prevent a behaviour from happening, rather than cause something to change or happen.

How to Update a Regex Pattern

You might have some instructions to add a piece of regex pattern to an existing value. This can be confusing if you're not familiar with Regex. Or you might have an empty field for the particular setting and don't know what to include.

1) Value is an empty field

When the regex pattern field you wish to use has no value in it, you can just enter the matching pattern. Regex can be as simple as matching a piece of text. So, if you want to match on a particular page called 'Timber', you'd just enter 'timber' into the regex pattern. If you want to match 'Timber' and 'Wood', then you'd separate the two patterns with a | which means 'or' in regex, like this : timber|wood

2) Value has an existing pattern in it

In this case, generally you want to append your value to the end of the pattern, using a | separator. The | character means 'Or' in regex, so you are specifying 'match this or that'.

If the existing pattern ends with a closing bracket ')', you would normally include the new part of the pattern inside the closing bracket. Do this unless you know to do otherwise. For example, if the 'ignoreRegex' pattern ends with something like this :


and you need to add on 'ajax', then do this


This means 'or xml or jpg or ajax'.

If you need to construct a more specific regex pattern there are many regex help sites on the internet.

Listing of Regex Patterns

Note that new fields are added over time with new versions of Url Master. If you cannot see a field mentioned here in your installation, it is probably because it has been introduced in a newer version.

'ignoreRegex' : Do not attempt to rewrite or redirect any Url which matches this Regex expression

This value serves as a gatekeeper to the module. Any url which matches this value will be completely ignored by the Url Master module.

'doNotRewriteRegex' : Any Url matching this Regex expression will not be rewritten and processed by DotNetNuke.

This value serves as a gatekeeper to the rewriting function of the module. If a Url matches this pattern, then it will still be processed by the module, but no rewriting will be done. Generally this means that the relevant portal will be identified, and the 'portalSettings' object will be stored in the request context. If a Url is receiving a 404 error, but it shouldn't be rewritten (for example, a http handler) then it may need to be included as part of the regex pattern.

'doNotRedirectRegex' : Do not Redirect any Url's which match this regex expression

Any Url matching this regex expression will not be redirected by the Url Master module. Generally if you are getting an unwanted redirect on a request, then changing this regex to match the Url will stop the behaviour. Note that this affects all redirects for the Url, so care must be taken with the pattern.

'doNotRedirectSecureRegex' : Do not redirect http <-> https when Url matches this pattern

This regex pattern is used to stop a redirection from a http request to a https request.

'forceLowerCaseRegex' :Do not change case of urls that match this regex

This pattern is used in conjunction with the 'forceLowerCase' option. Any Url which matches this regex will not be forced to lower case if requested in mixed or upper case. Generally this value is used to prevent a particular url from being forced to lower case because the lower case version of the url doesnt' work. Some modules have case-sensitive querystring parameters, and excluding the page the module is on using this regex will fix the problem.

'noFriendlyUrlRegex' : Do not generate a friendly url for any path matching this regex pattern

This regex is used to exclude sections of a DNN site from having Friendly Urls generated. This can be done from a parent-page level or just for certain Urls that match a pattern. This is used when a module does not work with the Human-friendly Urls that the Url Master module generates, and the specific Urls the module works with need to be excluded from having friendly urls generated.

'doNotIncludeInPathRegex' : Do not include matching items in friendly url path - force to be in the querystring

When Urls are generated in DotNetNuke, any values in the querystring besides the TabId are appended to the back of the Friendly Url. This is done so that a request of ?tabid=38&key1=value1&key2=value2 is transformed into /pagename/key1/value1/key2/value2.aspx

If the end Url is not desired as a full friendly url, a regex pattern can be entered so that parts of the url can be left as part of the querystring. For an example, using the previous Url, a regex pattern of 'key2' would result in a Url of /pagename/key1/value1.aspx?key2=value2

'triggerDictionaryRebuildRegex' : Rebuild Page Index and Update Cache when Url matches this Regex

This value is used to drop the page index which is at the heart of the module and create a new page index. Generally this is used to update the page index to include a new url, for example, on page creation or portal creation. This pattern is only matched on POST requests.

 |  View Topic History  |