tags:

views:

148

answers:

2

I have to put a site down for about half an hour while we put a second server in place. Using .htaccess, how can I redirect ANY request to domain.com to domain.com/holding_page.php?

+1  A: 
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/holding_page.php$ 

RewriteRule $ /holding_page.php$l [R=307,L]

Use 307 (thanks Piskvor!) rather than 302 - 307 means:

The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests.

Dominic Rodger
+1, but in this case I'd use temporary redirect: [R=307,L]
Piskvor
@Piskvor - excellent suggestion, edited in!
Dominic Rodger
This is giving me an Internal server error?
stef
This seems to workRewriteEngine onRewriteCond %{REQUEST_URI} !/indexTEMP.php$ RewriteRule $ /indexTEMP.php [R=307,L]
stef
A: 

This works better...

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/holding_page.php$ 
RewriteRule $ /holding_page.php [R=307,L]
Antony