Jaroslav Zeman
Jaroslav Zeman

Reputation: 17

Rewrite module replace char # to URL equivalent %23

How to replace in URL char # to its URL equivalent %23? Example:

https://example.com/common/rest/sitck?Param1=46694#2205923&Code=123

to

https://example.com/common/rest/sitck?Param1=46694%232205923&Code=123

Upvotes: 1

Views: 91

Answers (1)

Stephen Ostermiller
Stephen Ostermiller

Reputation: 25585

It is not possible to replace a # in a URL using a rewrite rule. The hash and everything that comes after it is called the "fragment identifier." That part of the URL is never sent to the server. It is client side only. Therefore it is not possible to manipulate it in a rewrite rule on the server.

The best you can do is examine the URL with client-side JavaScript. You can get and set the URL using the location.href variable in your web page.

Upvotes: 1

Related Questions