简体   繁体   中英

Single URL Rewrite rule to remove shebang and force HTTPS in IIS

I have a URL like so: demo.url.com/folder/folder2/#!/param1/param2

I'm trying to force HTTPS which I have done successfully, however when I attempt to use regex rule to also remove the #!, I get an error in the redirect.

This is what I currently have:

    <match url=".*" />
<conditions logicalGrouping="MatchAny">
                    <add input="{HTTPS}" pattern="off" />
                    <add input="{REQUEST_URI}" pattern="[A-Z]" ignoreCase="false" />
                    <add input="{QUERY_STRING}" pattern=".+\#!.*" negate="true" />
 </conditions>
 <action type="Redirect" url="https://demo.url.com/{URL}" />

It is not possible to do a redirect based on the hash string. Browser doesn't transmit the part after hash to the server.

It's called Fragment identifier and is client side only. That means that you will not be able to see this part on server side

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