I am trying to rewrite a path from foo to bar with a page anchor tag in the url like such
rewrite /foo /bar#locationOnPage
I have also tried using redir and uri replace, but kinda stuck here.
My understanding is that the #anchortag part of a url is kept by the browser and never sent to the server so I'm not sure if it is possible to rewrite to a #url.
You could try a redirect which may be what you wish.
Perhaps @whitestrake might have more info. The caddy forums are a great place to ask these sorts of questions