-1

Possible Duplicate:
How to implement “Maintenance Mode” on already established website

I realize it's not advised but what "quick and dirty" approach could be used to do maintenance changes to a web site such that are hidden from public view ?

Edit: To add more detail, the stuff I want to hide is what's being developped. The existing or established content should still show as if the site were live.

Community
  • 1
  • 1
James P.
  • 19,313
  • 27
  • 97
  • 155

2 Answers2

1

Using a .htaccess is more secure as it will handle ALL urls (php or not) :

RewriteEngine on

RewriteCond %{REMOTE_ADDR} !215.252.232.22
RewriteRule .* http://domain.ext/maintenance.html [L]
Jscti
  • 14,096
  • 4
  • 62
  • 87
0

this is dirty, but you could do something like replacing "##.##.##.##" with your IP:

if($_SERVER['REMOTE_ADDR']=='##.##.##.##'){
    //test code
}else{
    // live code
}

Note: I do not advise doing this, but it is quick and easy.

Samuel Cook
  • 16,620
  • 7
  • 50
  • 62
  • This would (sort of) work if you had some way to add it to every PHP page (maybe via a global include?). It also wouldn't prevent access to .html files, .png images, etc. But the .htaccess suggestion in the comment to the OP I think is a better approach – jedwards Nov 13 '12 at 21:44