如何在url中使用#作为htaccess中的redirect规则

我有一个困难的时候搞清楚如何有以下工作:

  • 我正在尝试在htaccess中redirect一个url
  • 我正在尝试从example.com/test.htmlredirect到example.com/index#test

我有以下设置

RewriteRule ^test.html http://www.example.com/index#test [R=301,L,B]

但是,它不起作用,因为浏览器redirect到http://www.example.com/index%23test并返回未find的页面。

我尝试了许多不同的标志,但没有成功。

谢谢,

其实,一个朋友帮我解决这个问题。

RewriteRule ^test.html http://www.example.com/index#test [R=301,NE,L]