roopteja
roopteja

Reputation: 737

Remove '#' in Url from IIS

I have an angular application and deployed it in IIS. The URL is as follows: sample.contoso.com/#/

I have removed hash location Strategy and now the URL is as follows: sample.contoso.com

But we have shared some links for analytics containing #. Can we add a rewrite rule like this in IIS

URL : sample.contoso.com/#/Home?id=1

rewrite URL : sample.contoso.com/?id=1

Thanks in Advance.

Upvotes: 0

Views: 106

Answers (1)

YurongDai
YurongDai

Reputation: 2430

The portion of the URL after # (fragment) is never sent to the server in the request for the page as per HTTP spec. If you open your web inspector and watch the request for the page, you will see that the #/Home portion is not included in the request at all. Therefore, URL rewrite won't see it.

Similar threads:

How do write a rewrite rule in IIS that allows HTML anchors?

How does IIS URL Rewrite handle # anchor tags

Upvotes: 0

Related Questions