maintenance?

They have: 2 posts

Joined: Jun 2008

Hello not sure if this is the right place to post....

I have just built my website and users have signed up but now i cant do any work on it because the site will still be open to users... if i start playing around with the files users will see errors and wont want to come back;

Is there some kind of script that i can use to it shuts down the whole site and displays a page to just users that the site is in maintenance mode and will return shortly?

its not a cms its just a simple upload script but i need to be able to close it to the public to work on it ect...

So like admins can still view the site but users cant... im not sure on this one but would love to hear what you have to say thanks in advance

Mark

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

To redirect all page requests to a temporary page, just add this to your .htaccess file.

RewriteEngine on
RewriteBase /
RewriteCond %{REMOTE_HOST} !^24\.1\.456\.123
RewriteCond %{REQUEST_URI} !/not-up\.htm$
RewriteRule .* /not-up.htm [R=302,L]

Just make sure your own IP is in the 3rd line. Make a copy of that line to add additional addresses as well.

Also, this code assumes that your temporary page is located at /not-up.htm. If it's not there, you will have to change those last two lines accordingly.

They have: 2 posts

Joined: Jun 2008

tyvm for this information i have now done it:D

He has: 629 posts

Joined: May 2007

Method I use: For php home page, put in an html page and use a .htaccess file to give html priority, if necessary. For an html home page, add a php page.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Or, alternatively, rather than remove users access to the site when you work on it, you can "mirror" (copy) your entire site for working on.

So you would work on the mirrored site and when you have completed something and fully tested it to confirm there are no errors, you can then simply copy it to the live site. Users might get a little disruption, but only seconds.

All this depends on what you work on of course. If you are working on something where you need to stop users inputting or using a function as you need to take the current data from live and change it to a new procedure, then you would not want users inputting more data in "the old way", so then you might still want to "close" the site for that.
But general improvements/maintenance etc can be done on a mirror site and avoiding the downtime.

And even if you need to shut down the site just to upload new code, working on the mirrored site makes downtime a few seconds, rather than the time you are making/editing code as well.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Yes, depending on how important the site is and how much traffic is pulled. This article explains how you can work on different copies of your site and push changes to your production location quickly and easily. I have been using this method on my recent projects and it's so much easier to maintain. Repositories are amazing. Smiling

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

This is a very good article and I probably will try it out on next project

I just went through setting up dev test sites for a group of 4 related sites with about 200,000 files (a lot of member images)

In Plesk I could not archive and extract I had to use ftp

In such a massive ftp process some stuff got left out or corrupted and I had to make a second pass to clean it up (I used Filezilla and redid the failed transfers)

Probably the worst part of the process was copying the MySQL database in 20 stages. Now I know about Big Dump that handles big db migrations.

I have used Tortoise SVN for some other projects but never thought about using Subversion for web dev

cool!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.