I have been struggling to get Umbraco (7.1.4) to prefix URLs without www with www. I can't quite grasp the syntax of UrlRewriting.Net.
My current solution is:
<add name="forcewww http"
virtualUrl="http\://(?!www\.)"
redirectMode="Permanent"
destinationUrl="http://www."
ignoreCase="true"
redirect="Domain" />
But I would like it not to trigger for URLs for the Umbraco backend (containing /umbraco).
Something like (\/umbraco|\/data|\/install|\/usercontrols|\/umbraco_client)).
The solution should be valid for multiple domains/tlds.
Your help is much appreciated!
We use this syntax in the urlReWriting.config:
The (.*) is translated into the $1 on the destination domain. If you would like to have it cross domain you could replace the domain by a wildcard match. But I would not do that. For every domain we configure in umbraco, we add a new line in the UrlRewriting.config. Works fast and flawless. Easy to maintain of someone decides to have a reverse (non-wwww default) on one domain.
We also redirect for the umbraco specific URLS because:
Apart from that we noticed that canonical URLs also help in indexing the correct domain...