Htaccess trick

Here's what I ended up putting in an .htaccess file for each of the various sites I run/own/manage to participate in the SOPA/PIPA protest today:

RewriteEngine On
RewriteCond %{TIME_HOUR}%{TIME_MIN} >0459
RewriteCond %{TIME_HOUR}%{TIME_MIN} <1701 RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} =20120118 RewriteRule ^(.*)$ [R=307,NC,L]

Learn something new every day. *g*

This forwarded each site to the protest page for a certain time frame (the length of the protest, adjusted for the server's time). You could use something like that to put a site in maintenance mode, for example. Just be sure to add a RewriteCond that checks for your IP so you can get to the site to test it. ;)

Leave a Reply