简体   繁体   中英

IIS rule rewrite for query string

I have a URL that looks like

https://thesite.com/m/?pageName=profileSettings#notifications   

I need to rewrite it to

https://thesite.com/m/?pageName=notificationSettings

I'm trying something like

            <rule name="m_notifications" stopProcessing="true">
                <match url="^m/(.*)" />
                <conditions>
                    <add input="{QUERY_STRING}" pattern="pageName=profileSettings#notifications" />
                </conditions>
                <action type="Rewrite" url="pageName=notificationSettings" appendQueryString="False"/>
            </rule>

This isn't working, no errors, just not making any changes. What am I missing?

Thanks

It is not possible to do a rewrite 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. It's not possible in any language unless you are using some browser implementation (or software) which would send that part of URL to the server.

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