Fix #9 security and improve URL Rewriting