Hi there I am attempted to do a proper IIS rewrite utilizing the IIS manager credentials my hosting provider has given me. I have no experience with this and the articles I have read online so far have not been too helpful.

Here is the scenario: I have an ASP.net MVC 5 website (reallylongmaindomain.com, for ease of reading) that physically has the files uploaded to it. It is secured with an SSL certificate. The literature we are handing out has a shorter domain (not a URL-shortened domain) that we will call shortdomain.com, which does not have any files. However, if you navigate to shortdomain.com, you get an SSL domain name mismatch error (ERR_CERT_COMMON_NAME_INVALID to be precise). This is what I need to avoid.

In comes the IIS manager. I have successfully logged in to the system and added a URL Rewrite. This is the rule I have: (http(s)?://)?(www.)?shortdomain.com. This handles any http/https and/or www that the user may put in the address bar. The action properties are set to "Redirect" (Permanent 301) and the Redirect URL is set to https://reallylongmaindomain.com, but I am still getting the SSL certificate error and the URL in the window is still shortdomain.com.

I am sure I am just missing a simple thing or two. Do I also need to add the rule into my Web.Config file? I was under the impression the IIS manager rules superseded the Web.Config rules. EDIT: The rule was added to my web.config, here it is:

            <rule name="site redirect" stopProcessing="true">
                <match url="(http(s)?://)?(www.)?shortdomain.com" />
                <action type="Redirect" url="https://reallylongmaindomain.com" />


1 Answer 1


Turns out this is the rule I was looking for:

    <rule name="redirect" stopProcessing="true">
        <match url=".*" />
            <add input="{HTTP_HOST}" pattern="^(.*)?shortdomain.com" />                 
        <action type="Redirect" url="https://reallylongmaindomain.com/{R:0}" />

After applying this rule, navigating to shortdomain.com resolves perfectly fine to https://reallylongmaindomain.com.

Hopefully this helps someone else out!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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