301 重定向到 URL 中带有 # 的域
301 redirect to domain with # in the URL
我目前正在尝试重定向以下内容:
bar.com/foo ====> bar.com/bar.html#/#
我的重定向规则如下:
RewriteEngine On
RewriteRule ^/foo$ bar.com/bar.html#/# [R=301,L,NC]
这是我 运行 测试卷曲时的输出:
301 http://bar.com/foo ======>
https://bar.com/bar.html%23/%23
它正在返回 301 HTTP 响应;但是,这些 %23 字符是一种编码指示,表明 # 将在重定向后出现在 URL 中,还是 URL 的文字表示?如果这是不正确的,我需要做任何转义吗?
在此先感谢您的帮助。
使用 NE
选项避免编码:
RewriteEngine On
RewriteRule ^/?foo/?$ /bar.html#/# [R=301,L,NC,NE]
确保在新浏览器中测试它以避免旧缓存。
我目前正在尝试重定向以下内容:
bar.com/foo ====> bar.com/bar.html#/#
我的重定向规则如下:
RewriteEngine On
RewriteRule ^/foo$ bar.com/bar.html#/# [R=301,L,NC]
这是我 运行 测试卷曲时的输出:
301 http://bar.com/foo ======>
https://bar.com/bar.html%23/%23
它正在返回 301 HTTP 响应;但是,这些 %23 字符是一种编码指示,表明 # 将在重定向后出现在 URL 中,还是 URL 的文字表示?如果这是不正确的,我需要做任何转义吗?
在此先感谢您的帮助。
使用 NE
选项避免编码:
RewriteEngine On
RewriteRule ^/?foo/?$ /bar.html#/# [R=301,L,NC,NE]
确保在新浏览器中测试它以避免旧缓存。