Results 1 to 13 of 13

Thread: Site offline [maintenance] button.

  1. #1
    Member H4CK3R's Avatar
    Join Date
    Oct 2011
    Posts
    45
    cPanel/WHM Access Level

    Website Owner

    Default Site offline [maintenance] button.

    Hi,
    What about a button in cpanel to make whole site unavailable with a custom message, "Site is currently under maintenance".

    Why:
    Every site needs some maintenance which may disturb users, so i think this option will help a lot.

    Thanks for reading.

  2. #2
    Member monarobase's Avatar
    Join Date
    Jan 2010
    Location
    France
    Posts
    494
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    If you could enter your IP and activate the maintenance page for all other IP's this could be an interesting feature, and quite easy to do with an .htacess file.

    +1 for a maintenance mode that adds code to the .htaccess file to show a maintenance page to everyone except a specified list of IP's.

    As far as we are concerned, this would be an interesting feature but not high on our list of priorities !

  3. #3
    Member
    Join Date
    Apr 2011
    Location
    US
    Posts
    210
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    Yes, this would be a nice addition ... anyway you can always just put a index.php file with "Site is currently under maintenance" text.

  4. #4
    Member H4CK3R's Avatar
    Join Date
    Oct 2011
    Posts
    45
    cPanel/WHM Access Level

    Website Owner

    Default Re: Site offline [maintenance] button.

    Thanks guys for the comment. But, uploading index.php file wont help, because it will just work for www.example.com and not for www.example.com/about and for others.

  5. #5
    Member monarobase's Avatar
    Join Date
    Jan 2010
    Location
    France
    Posts
    494
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    You could also just password protect the site with a title saying that the site is in maintenance mode. This way you can still access your site but others can't.

  6. #6
    cPanel Support Manager
    Join Date
    Dec 2010
    Location
    Texas
    Posts
    99
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    Please note that this functionality is already inherently available via using a custom mod_rewrite rewrite rule.

    [1] Create and customize a file called: maintenance.php

    [2] Add the following to your .htaccess

    Code:
    RewriteEngine On
    RewriteRule !^maintenance.php$ /maintenance.php [R=302,L]
    Any accesses to any page on the site OTHER than maintenance.php will be redirected to maintenance.php. Therefore, this disables all links/pages/etc. on the site other than maintenance.php

    You can then comment out that rewrite rule as desired to enable/disable maintenance mode within seconds.

    A full on feature to automate this, while not out of the question, seems a bit heavy handed given the 2-step process to activate it as it is now. In addition, many scripts in existence already have inherent "Maintenance Mode" functions within them.

    EDIT
    To address monarobase's request to allow maintenance mode to "exempt" certain IPs, you could modify Step 2 to the following rule:

    Code:
    RewriteEngine On
    RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$
    RewriteCond %{REMOTE_ADDR} !^100\.100\.
    RewriteRule !^maintenance.php$ /maintenance.php [R=302,L]
    And so on. The above would exempt "123.123.123.123" and "100.100.*.*" from the rewrite and thus allow them to access the site. This admittedly can be a bit more complex since you need some basic Regular Expressions knowledge, but is still readily possible with cPanel as it stands right now.
    Last edited by Brian; 01-21-2012 at 08:01 PM. Reason: Provided solution for monarobase's request

  7. #7
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    10,122
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    Moved to Workarounds forum.

  8. #8
    Member H4CK3R's Avatar
    Join Date
    Oct 2011
    Posts
    45
    cPanel/WHM Access Level

    Website Owner

    Default Re: Site offline [maintenance] button.

    Yes, it worked, thanks.
    But, what about subdomains? Do i have to add these lines to all .htaccess files of all subdomains?
    And, i also need to ask one more question, should i ask here or create a new topic?
    Question: I have a file, and i want to copy it to my all subdomains, (14 subdomains ) , i have to copy one by one, is there any way that i can copy to all at once?
    Thanks.

  9. #9
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    10,122
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    Different topic, different thread is always the best way to go.

  10. #10
    Member Indianets's Avatar
    Join Date
    Jun 2008
    Posts
    62
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    Interesting!

    In /home/USER/.htaccess (note that not in public_html)

    Code:
    <Files *>
    Order Deny,Allow
    Deny From All
    Allow From x.x.x.x
    </Files>
    
    ErrorDocument 403 "The Site is down for maintenance! Please come back later!"
    Easy! No?

    - Vijay

  11. #11
    Member H4CK3R's Avatar
    Join Date
    Oct 2011
    Posts
    45
    cPanel/WHM Access Level

    Website Owner

    Default Re: Site offline [maintenance] button.

    Thanks.

  12. #12
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    976
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    Does anyone know of a workaround to have this feature enabled, but not allow the end user to disable the "maintenance mode" on their website?

    i.e. let's say a website is defaced, I want their account to still be active for emails to work, but the website should be unavailable, till such a time as when the user fix or re-upload their website to the server
    • cPanel :: Fantastico :: RVSkin :: WHM :: ModernBill
    • Reseller Hosting :: SSL Certificates :: Domain Registrations :: Affiliate Program
    • Blog Hosting :: CMS Hosting :: Forum Hosting :: E-Commerce Hosting

    SoftDux- The Leaders in Software
    Use the coupon: cpanel-06 to get 20% off our packages

  13. #13
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Site offline [maintenance] button.

    You could have a cron periodically overwrite any .htaccess with the content you've placed into it for that account. If you wanted to get really fancy, you could have a file of users in maintenance that is used for the cron script so that you don't have to manually figure out and revise each user. That way you could just edit /root/maintenanceusers or something each time someone is added or removed.

    For the copy of the .htaccess, you could have the .htaccess stored somewhere else on the server as a backup copy in that instance for the cron script to pull the contents.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Replies: 8
    Last Post: 02-18-2010, 09:11 PM
  2. Taking my site offline if it recieves a lot of traffic
    By Daniel591992 in forum New User Questions
    Replies: 1
    Last Post: 10-13-2007, 05:39 AM
  3. How can I download the site to work offline?
    By Voiddweller in forum New User Questions
    Replies: 4
    Last Post: 12-06-2005, 02:05 PM
  4. Zipservers site offline?
    By krystalx in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 07-05-2005, 05:24 AM

Tags for this Thread