Replace %23 with # in URL

I’m trying to setup Grav to replace %23 in page URL with #

e.g. redirect from page like this
https://voyahchat.ru/common/account%23ios

to this
https://voyahchat.ru/common/account#ios

I edited .htaccess file and added line

RewriteRule ^(.*)(%23)(.*)$ $1\x23$3 [NE,R=301,L]

or line

RewriteRule ^(.*)?%23(.*)?$ $1#$2 [NE,R=301,L,B]

but with no luck, I’m getting 404 error.

Is .htaccess can process URLs in such way?

Or may be I can achieve this functionality editing some GRAV file?

This is works as expected

RewriteRule ^(.*)#(.*)$ /$1#$2 [NE,R=301,L]

IMO this shouldn’t be handled on target website, but rather on the source, where such URL is constructed :man_shrugging:

I can’t fix broken Telegram clients, but I can replace this on the side of my site, so I do.

1 Like