help, I need a quick full-site replacement page!

You know, like the one Apple does during a keynote or whatever?

It’s easy with mod_rewrite – just add the following in a .htaccess (if your host supports that…)

RewriteCond %{REQUEST_URI} !/backsoon.html$
RewriteRule ^.*$ /backsoon.html [L]

and every page that is not /backsoon.html will be temporarily replaced with the contents of backsoon.html

Don’t forget if you have images/css linked into backsoon.html, you’ll need to add a RewriteCond to except the rewrite.

RewriteCond ${REQUEST_URI} !/images/yourheader.png$
RewriteCond ${REQUEST_URI} !/css/yourcss.css$

Here’s the whole thing :

RewriteCond ${REQUEST_URI} !/images/yourheader.png$
RewriteCond ${REQUEST_URI} !/css/yourcss.css$
RewriteCond %{REQUEST_URI} !/backsoon.html$
RewriteRule ^.*$ /backsoon.html [L]

Enjoy, and thank Mike for prompting me to write this up!

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>