简体   繁体   中英

Rewrite URL rule for direct/base application only

Im looking for a url rewrite to change:

/myapplication/  -> www.otherUrl.com

However the rest of the files should still work the same

/myapplication/default.aspx  -> /myapplication/default.aspx

only accessing the base application "/myapplication/" should cause the redirect.

I been trying with

      <rule name="Redirect home" stopProcessing="true">
         <match url="/myapplication/" />
            <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
            </conditions>
        <action type="Redirect" url="www.otherUrl.com" redirectType="Permanent" appendQueryString="false" />
      </rule>

however this rewrites the entire application to otherurl.

I believe you need an exact match:

 <match url="^myapplication/?$" />

Notice the characters to denote the beginning and end.

The question mark is for the path slash at the end. It makes it optional.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM