Added optional URL rewriting