Skip to content

Instantly share code, notes, and snippets.

@pedroadaodev
Last active July 17, 2017 10:28
Show Gist options
  • Save pedroadaodev/1b7178c91a579ae5774e783c310b1a70 to your computer and use it in GitHub Desktop.
Save pedroadaodev/1b7178c91a579ae5774e783c310b1a70 to your computer and use it in GitHub Desktop.
Don't use /umbraco/urlRewriting.config because its slow, very slow. Use it on web.config.
<?xml version="1.0" encoding="utf-8"?>
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<!--
URLRewriting.net is obsolete and will be removed from Umbraco in the future.
If you want to do rewrites, make sure to use IIS URL rewrite: https://www.iis.net/downloads/microsoft/url-rewrite
The advantage of using IIS rewrite is that it is much faster, much less CPU intensive and much less memory intensive.
-->
<add name="CarDetail"
virtualUrl="^~/2017/car/detail/(.*)"
destinationUrl="~/2017/car/detail/?receita=$1"
rewriteUrlParameter="ExcludeFromClientQueryString"
ignoreCase="true" />
<add name="RedictToAnotherUrl"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="http://www.oldurl.pt/(.*)"
destinationUrl="http://www.newurl.pt/$1"
/>
<add name="forcewww"
virtualUrl="http\://(?!www\.)"
redirectMode="Permanent"
destinationUrl="http://www."
ignoreCase="true"
redirect="Domain" />
<!-- OR you can force NON WWW. Just use one -->
<add name="RemoveWWW"
redirect="Domain"
ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="http://www\.(.*)"
destinationUrl="http://$1"
redirectMode="Permanent"
/>
</rewrites>
</urlrewritingnet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment