I have no idea why this isn't working. I've tried creating map rules and then rewriting and redirecting the URL. I've tried just redirecting it with a simple rewrite rule and no matter what, the only time I can get it to work is if I set the match URL to match this regex .*.

I'm trying to redirect webmail.example.com to mail.example.com. Seemed like it would have taken but a couple seconds; boy was I wrong. I'm thinking I must be doing something wrong with the regex, but I'm not sure what as when I test it it seems to work fine.

            <rule name="webmail" patternSyntax="ECMAScript" stopProcessing="true">
                <match url=".*webmail.*" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <action type="Redirect" url="https://mail.example.com:8000" appendQueryString="false" logRewrittenUrl="true" />
  • This might be unrelated, but... I've had problems trying to redirect a webmail subdomain before (on Apache as it happens) on a shared host. A webmail subdomain had already been setup by the hosting provider and there was a conflict.
    – MrWhite
    Sep 17, 2012 at 21:32

2 Answers 2


You should setup a CNAME record in DNS that gives the alias webmail.example.com to mail.example.com. If you don't manage your own DNS server, then this may be able to happen at your registrar. If you are running your own internal DNS server, then you would need to edit the DNS on the appropriate machine. If this is handled by your webhost, then you would need to handle it through one of their interfaces (like cPanel or something else).


I assume that you don't have DNS access then - as this would take seconds to set up!

I see your filter is: <match url=".*webmail.*" />.

I may be totally wrong here but, you have a . before the first wildcard; surely it is looking for anything that includes this 'dot' in that position, which the URL you are working with doesn't; surely it should just be <match url="*webmail.*" />.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.