Q:

301 redirect to domain with # in the URL

I'm currently attempting to redirect the below:
bar.com/foo ====> bar.com/bar.html#/#

My redirect rule is as follows:
RewriteEngine On
RewriteRule ^/foo$  bar.com/bar.html#/#  [R=301,L,NC]

Here's the output when I run a test curl:
301 http://bar.com/foo ======>
https://bar.com/bar.html%23/%23

It's returning a 301 HTTP response; however, are these %23 characters an encoding indication that the # will be present in the URL after the redirect, or a literal representation of the URL?  Is there any escaping I need to do if this is incorrect?  
Thanks in advance for your help.

A:

Use NE option to avoid encoding:
RewriteEngine On

RewriteRule ^/?foo/?$ /bar.html#/# [R=301,L,NC,NE]

Make sure to test it in a new browser to avoid old cache.

