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.



Actually, a friend help me out with this.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.