Redhat – How to use # in url as a redirect rule in htaccess for apache

.htaccess301-redirectapache-2.2redhatrewrite

I am having a difficult time figuring out how to have the following work:

  • I am trying to redirect a url in htaccess
  • I am trying to redirect from example.com/test.html to example.com/index#test

I have the following setup

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

However, it is not working because the browser redirects to http://www.example.com/index%23test and returns a page not found.

I have tried many different flags without success.

Thanks,

Best Answer

Actually, a friend help me out with this.

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

Related Topic