main page rewrite