Fix URL rewriting of fragment-only links

Fix for #945