I'm effectively taking down a site and replacing all pages with a single "Goodbye" page which I'd like to have all requests for the many other pages on the site redirect to.

I'd like to have them all redirect to the goodbye page, which has been set to be the front page.

I'd like to include the 404 page in this. In other words, ALL requests for existing or non-existing pages get redirected to www.mysite.com/

I can't seem to do this within htaccess because then all the requests for js and css/etc needed in the goodbye page will not be available.

What I'd like is similar to the maintenance mode plugin, except to have it simply pull up the chosen page that I've created.

Is there a clever way to do this using the WP backend, or programmatically, or even in htacess?

Any advice on how to do this would be appreciated.


I found the answer with a little more searching. Sorry -- Admins feel free to delete this question!

The answer is here

add_action( 'template_redirect', 'wpse_76802_maintance_mode' );

function wpse_76802_maintance_mode() {
    if ( ! is_page( 1618 ) ) {                                                                                  
         wp_redirect( home_url( 'index.php?page_id=1618' ) ); 

EXCEPT .... if there is a way to enhance this redirect so that a 301 header gets added into the mix, that would be even better.


Not the answer you're looking for? Browse other questions tagged or ask your own question.