DNN uses regular expressions (regex) to specify rules on how to translate URLs. Regex rules control whether a URL will be rewritten, and how to convert in and out of Friendly URLs. You can customize many of the regex rules for URL management through the DNN UI.
NOTE: Regular expressions as a whole are too large of a concept to be covered in this article, and are beyond our scope of support. Care should be taken when editing regular expressions, as an incorrectly-written rule can lead your site to become un-browseable. Always test your solutions in a safe environment first.
- Go to Persona Bar > Settings > SEO
- Go to the URL Management tab, and then the Expressions subtab.
- The various fields on this page contain the regular expressions for different URL management functions. You can customize them as needed. For more information on each, see the table below. You can also mouse over the information icon to the left of the field title.
Field Description Ignore URL Regular Expression Defines the set of URLs that should be ignored for rewriting, redirecting, or any other processing by the URL Rewriter. Typically, these would be images, CSS files, PDF files, and other assets. Do Not Rewrite URL Regular Expression Defines the set of URLs that should be ignored for rewriting. Site URLs Only Regular Expression Defines the set of URLs that must be first checked against the siteURLs.config file, which contains explicit rewriting and redirect instructions. Do Not Redirect URL Regular Expression Defines the set of URLs that should not be redirected under any condition. Do Not Redirect Https URL Regular Expression Defines the set of URLs that should not be redirected if the redirect would go from HTTP to HTTPS or vice versa. Prevent Lowercase URL Regular Expression Defines the set of URLs that should not be set to lowercase. Use this if the URL contains an encoded character or a case-sensitive code. Do Not Use Friendly URLs Regular Expression Defines the set of URLs that should be preserved. Typically used for backward compatibility. Keep in Querystring Regular Expression Defines the part of a generated URL that must be preserved in the query string. Example: If this field contains /key/value and a generated URL is /pagename/key/value, then the generated URL is replaced with /pagename?key=value URLs With No Extension Regular Expression Defines the set of URLs for pages or resources that are not on the server, are not a DNN page, and can be requested without an extension. These URLs will not return a 404 status even if the page or resource is not found. Valid Friendly URL Regular Expression Defines the set of characters that are valid for a friendly URL. Characters that do not match the regular expression will be deleted from the generated URL.
- Click Save when done.
- Clear your server cache and restart the application to apply all changes. Note that some changes may be prevented from appearing immediately due to a visitor's browser cache.