I am attempting to rewrite the URL on my website using the .htaccess but have had no luck so far. I want to add a hash to the URL and redirect.
I want to get the last file in the URL and redirect it to the same URL but append a # symbol before the last file. The reason I want to do this is for my website, all the content is loaded dynamically without refreshing the page.
For example, www.example.com/foo would become www.example.com/#foo
or www.example.com/form/bar.php would become www.example.com/form/#bar.php
I don't mind if I need one entry for each page, I have tried many variations but nothing has worked so far.
RewriteRule ^(.*)foo(.*)$ $1#foo$2 [R=301,L]
RewriteRule ^(.*)/(.*)$ /$1#$2 [L,R=301,NE]
RewriteRule ^foo/?$ /#$0 [L,NE,R=301,NC]