views:

5

answers:

1

I'm trying to redirect any non-www prefixed traffic to the www prefixed domain. I'm using Umbraco as the CMS and have added the following code into the urlrewritingnet config file:

<add name="nonWWW" 
                virtualUrl="^(?!www\.)(.*)$" 
                rewriteUrlParameter="ExcludeFromClientQueryString" 
                destinationUrl="http://www.domain.co.uk$1" 
                ignoreCase="true" />

I'm getting a "is not a valid virtual path" error

A: 

This seems to be working:

<add name="nonWWW"
                redirectMode="Permanent"
                redirect="Domain"
                ignoreCase="true"
                rewriteUrlParameter="IncludeQueryStringForRewrite"
                virtualUrl="http://domainname.co.uk/(.*)" 
                destinationUrl="http://www.domainname.co.uk/$1" 
                 />
Ian Houghton