Move rewrite conditions to the top as they are not specific to custom pages