I published an e-book which has dozens of embedded links in it, all in this format:
(myurl.com is hosted at GoDaddy using Managed Wordpress, and #v60 is an anchor to video number 60 on that page.)
This seems to work flawlessly for most people. However, I just had one buyer of the book who is annoyed that the links lead to a 404 page. I asked him for a screenshot, and it appears -- for some reason -- that the URL in the bar is this:
http://myurl.com/videos/%23v60
I checked my raw EPUB and MOBI files for the ebook, and they're both fine, so my only conclusion is that his reader is doing something funky with the # sign and converting it to %23.
So I thought -- what if I go into the htaccess file and write a custom forwarder to take someone from the bad URL (the second one) to the first?
I wrote this into my htaccess file:
Redirect /videos/%23v60 http://myurl.com/videos/#v60
But it doesn't work. If I go to the bad URL (http://myurl.com/videos/%23v60) I get an error 404.
Any tips on writing the URL redirection properly?
@ddas can you check this?
RewriteRule ^/?videos/(.*?)/ ^/?videos/${unesc:$1} [R,L,NE,NC]
Hope it helps!
I tried it and it didn't work. Sorry...
Small note: in my real site the word is not actually "videos" -- it's three words separated by hyphens and a digit afterwards. So in trying your solution, I replaced "videos" with the actual string. For illustrative purposes, pretend the string is "all-videos-page-4" -- I wrote this into my htaccess:
RewriteRule ^/?all-videos-page-4/(.*?)/ ^/?all-videos-page-4/${unesc:$1} [R,L,NE,NC]
Let me know if I did that wrong.