Examples
How to redirect //site.com to //www.site.com
There are two methods in which this can be achieved:
- Use the
Portal Aliasessettings to choose how the site is accessed:- When it is set to
anyboth URL types are accepted. - When it is set to
wwwonlywww.URLs will be accepted and redirects will be made to accomplish that.- Note: when this option is selected a check-box will show up that changes the behavior for sub-domains. When that option is checked sub-domains will be accessible without the
www.in front of them.
- Note: when this option is selected a check-box will show up that changes the behavior for sub-domains. When that option is checked sub-domains will be accessible without the
- When it is set to
non-wwwonly URLs withoutwww.will be accepted.
- When it is set to
- Use the
Advanced Rulessettings:- When you need to redirect a site or any URLs which are not using
www.and you want to force them to usewww.for all//orhttps://calls, then you need to create an Advanced Rule in URL Adapter like:
Match In: Absolute URL Condition: //site.com/{*} Target URL: //www.site.com{*} Type: Redirect
- In this way, only the specified portal will be “affected” by the advanced rule, and if you have, for example, other portals like
//blog.site.com, it will remain withoutwww.
- When you need to redirect a site or any URLs which are not using
Redirects to https://
URL Adapter also provides the ability to redirect all // traffic to https:// - it respects the HTTPS settings made in DNN (Admin > Site Settings and page settings), therefore, pages checked as secured should be served with https://.
There is also an advanced rule if you want to redirect from // to https:// without relying on DNN settings:
Match In: Absolute URL
Condition: //site.com/{*path}
Target URL: https://www.site.com{*path}
Type: Redirect
How to rewrite an URL
If you want a shiny new URL there are two steps you need to make in Advanced Rules:
-
Firstly, a Redirect rule is needed from A to B use the Relative Path in Match In section Condition: /resources/news?tabid=275&artmid=1255&articleid=5 Target URL: /resources/news/ServiceProvider
-
Then, you need to Rewrite from B to A so behind the scene it renders the
/resources/news?tabid=275&artmid=1255&articleid=5page: Condition: /resources/news/ServiceProvider Target URL: /resources/news?tabid=275&artmid=1255&articleid=5
When there’s a # in the URL
This is an important note to be made, in Condition the # inside an URL will not be recognized and there might be some problems in recognizing the entire URL, but if you want to make a redirect/rewrite to a link which has # inside it, Target URL accepts it.

How to use a Token in an Advanced Rules
A simple basic example is to manually create a custom token with an URL inside the Constant String and use it in Target URL to make a redirect.
