Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

For the coming up SOPA blackout, I plan to shut down all of my websites. I'm not sure how to do this though! How do I make every web request made on any of my pages redirect to the same file? Any idea?

share|improve this question
1  
Are you planning a full shutdown (as I am for my personal site)? For sites where that's not feasible consider using the script from sopablackout.org (you can copy it locally if desired to avoid the risks inherent in calling a script from an external domain...) –  voretaq7 Jan 13 '12 at 22:54

2 Answers 2

In the server or vhost context (if you use .htaccess or directory context, drop the leading slashes):

RewriteEngine On
RewriteRule !^/sopa\.html$ /sopa.html [R,L]

This'll send a redirect (302) response for every page to the sopa.html page. Alternatively, you could return the sopa.html content for every request without redirecting, but I suspect this approach is better with regard to search engine reindexing.

share|improve this answer
3  
Note that you should be certain whatever method you use issue a 302 redirect ("Found:" -- temporary), not a 301 (Moved. Permanent.) to avoid upsetting search engines. 302 is the default in Apache (I believe all versions) but can be explicitly specified as R=302 if you're paranoid. –  voretaq7 Jan 13 '12 at 22:48

Google do not recommend using 302 for such protest message or maintenance page as this might affect ranking.

Here is how I do 503 error pages which is human readable as well:

RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} !=503
Alias /stop-sopa /var/www/stop-sopa
ErrorDocument 503 /stop-sopa/index.html
RewriteRule !^s/stop-sopa$ /stop-sopa [L,R=503]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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