I want: http://somesite.com to redirect to http://somesite.com/subfolder

Seems like a pretty simple request. I've followed the sources online, and they all indicate I should use ^$ for the regex pattern. I've also added an HTTP to HTTPS redirect, and it works fine. I've also tried disabling that rule just to make sure it wasn't interfering. This is running on IIS 10 / Server 2016.

My web.config looks like this:

<?xml version="1.0" encoding="UTF-8"?>
                <clear />
                <rule name="Redirect root to NmConsole" stopProcessing="true">
                    <match url="^$" ignoreCase="true" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Redirect" url="/subfolder" appendQueryString="true" />
                <rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTPS}" pattern="^OFF$" />
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />

Requests to the root domain do not redirect. Why isn't it working?


1 Answer 1


Maybe HTTP Redirect is more appropriate here, though the feature is not enabled by default.

For Windows Server, go through the add features and roles wizard and enable HTTP Redirection under Server Roles > Web Server (IIS) > Common HTTP Features

For Windows desktop, go through appwiz.cpl and Turn Windows Features On or Off instead.

Once that's enabled, you'll add:

   <httpRedirect enabled="true" destination="http://somesite.com/subfolder" />

to your web.config file and you should be in business. You can read more about it at Microsoft's documentation

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.