egolive
egolive

Reputation: 397

Redirect Subdomain URL to another SubDomain with a folder in IIS

i want redirect a subdomain to another subdomain, but additionally i want it to redirect to a folder.

I tried this:

<rewrite>
    <rules>
        <rule name="report" stopProcessing="true">
          <conditions logicalGrouping="MatchAll">
            <add input="{HTTP_HOST}" pattern="old.domain.com" negate="false" />
          </conditions>
          <action type="Redirect" url="http://new.domain.com/admin-dashboard/" appendQueryString="true" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

With my code i only redirect to the new subdomain. But my folder is ignored. What i'm doing wrong?

Thanks for reading

Upvotes: 0

Views: 618

Answers (1)

Victor Leontyev
Victor Leontyev

Reputation: 8736

Your rule is absolutely correct.

Problem is that all browsers will cache 301 redirects, because this redirect is permanent. To get around this, you'll just need to clear your browser cache.

If you put a permanent(301) redirect, that redirect will be cached in the browser for any visitors. You can’t clear the browser cache for your users, so if you need to change or undo a 301 redirect, the old redirect is still going to work until their cache expires.

P.S. Do not put a 301 (permanent) redirect in place unless it is truly permanent! You can use 302 redirect for that

Upvotes: 2

Related Questions