0

Hi from time to time , i want to shutdown my site for maintenance ...

How could i do this? I've seen a option in phpbb to block the site by admin and then unblock them..

Is there any apis for this or tell me a method of how to do this?

I'm using php for my website..

Vijay
  • 5,331
  • 10
  • 54
  • 88
  • Disconnect the server (but then you can't access it yourself) B) – RvdK Apr 16 '10 at 06:47
  • No .. that wont work.. When my customers enter my site they should be notified of site maintenance and they should not be allowed to login – Vijay Apr 16 '10 at 06:49

1 Answers1

5

I generally use a .htaccess file that contains something like this :

RewriteCond %{REMOTE_ADDR} !=MY_IP_ADDRESS
RewriteRule    ^$  /down.html  [L]
RewriteCond %{REMOTE_ADDR} !=MY_IP_ADDRESS
RewriteRule    [^/down.html$]  /down.html  [L]


Nice things with this idea are :

  • No PHP code involved -- which means I can totally do whatever I want with my PHP application, totally deleting it and re-uploading it, for instance, without any problem
  • I can test the website from one IP address (replacing MY_IP_ADDRESS by my real IP address), while everyone else will see the content of down.html

Once the maintenance operation is finished, I just comment those 4 lines, and voila, the website is re-opened ;-)

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
  • My ip address will be a dynamic ip.. so will that affect me at any point of time? – Vijay Apr 16 '10 at 06:52
  • If your maintenance operation only last for a couple of minutes, your IP address probably won't change during that time, will it ? *(I'm sometimes using a dynamic IP, and never had that problem)* – Pascal MARTIN Apr 16 '10 at 07:03
  • My operation may go upto 4 or 5 hours , and in that time if my internet connection is reset or my dynamic ip is changed someway , what could i do? Then can i access my site .. I'm asking in curiosity – Vijay Apr 16 '10 at 07:35
  • If your IP address changes, you won't be able to access your website ;; but changing the IP adresse in the .htaccess file will allow you to re-access you site, with your new IP ;-) *(And you probably won't change of address 10 times in 5 hours ^^ )* – Pascal MARTIN Apr 16 '10 at 11:00