I've run into an issue, which doesn't seem new or exciting, but of all the answers I've found none seem to work. I feel like programming for .htaccess there are a million ways to solve a problem but I can never find/use the correct one.
I would like to take an already clean URL:http://example.com/page/link
and do an internal rewrite to:http://example.com/page#link
My sources before asking:
http://stackoverflow.com/questions/2872490/how-to-use-htaccess-to-rewrite-url-to-html-anchor-tag
http://stackoverflow.com/questions/21391449/how-to-use-sign-as-an-anchor-while-url-rewriting-with-htaccess-on-apache
http://stackoverflow.com/questions/29165917/htaccess-rewrite-url-to-hash-anchor-on-homepage
http://stackoverflow.com/questions/2686075/mod-rewrite-with-anchor-link
http://stackoverflow.com/questions/2285193/htaccess-redirect-to-page-with-anchor-link
I've read over all the answers and comments to find a solution to my particular issue. Nothing has worked so far. I can't even get a simple test to work and it seems as if the rewrite isn't working at all.
You can find my current .htaccess file here: http://pastebin.com/xJWHq70f
NOTE: Web host is Netfirms. I've disabled Netfirms' default .htaccess foolery.
So to recap, I'm trying to take an already clean URL and further parse and rewrite from page/test to page#test. The last line in my .htaccess did have
RewriteRule ^about-me/(.*)$ /about-me#$1 [NE,R] (didn't work)
In theory creating a link on a page to about-me/who-am-i
should take me to http://example.com/about-me#who-am-i
while keeping the address bar looking like http://example.com/about-me/who-am-i
. At this time I have one specific page I'd like this rewriting to be enabled for, the about-me.php page.
Thanks,
Doug
PS
Sorry for not being 10+ rep so I can post all the links normally
UPDATE Jan 27 2016
Further review and further investigation proves what I'd like done simply cannot be done. No problem. I've switched gears and changed the way I'd like my navigation system to work.
Instead I will use the about-me page as a base and create the extra necessary pages needed. As there is a lot of text on the page it's better to break it up into nicer to read sections - now separate pages.
Using the idea William presented I was able to quickly forge together a solution. My original .htaccess code to remove the .php extension and then to redirect a .php extension to the non-extension equivalent was broken and caused the 500 errors. FIXED!
Using the following code:
RewriteRule ^about-me/(.*) /$1 [L,NC]
I can have any URL about-me/stats or about-me/testing123 and as long as the actual stats.php or testing123.php exists in the root it will be internally redirected properly - keeping a nice clean URL while 404'ing if the file doesn't exist.