Rewriting relative URLs