fixed media rewrite bug on main sites