I have what I thought was a very straightforward URL redirection scenario. Visit a simple easy-to-remember mydomain URL and be redirected to the very complicated cloud address.
This is what I have inside an apache2 virtual host.
ServerName clock.mydomain.com
RewriteEngine On
RewriteRule ^/$ https://sub.example.com/service/#/12345/login/webclock/1 [R=301,NC,L]
The issue is the #
in the destination URL. The #
is being html encoded as #
so the browser is looking and not finding https://sub.example.com/service/#/12345/login/webclock/1
How can I fix this? Everything I am reading is about dealing with special characters in the origin URL, not the destination URL.
CodePudding user response:
From the mod_rewrite documentation you need to use the NE
(no escape) flag when your rewrite rule has a hash.
ServerName clock.mydomain.com
RewriteEngine On
RewriteRule ^/$ https://sub.example.com/service/#/12345/login/webclock/1 [R=301,NC,NE,L]