Jump to content



Latest News: (loading..)

- - - - -

Site down for maintenance using htaccess


This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1   14steve14

14steve14

    STORE OWNER NOT CODER

  • Members
  • 3,080 posts

Posted 04 February 2012 - 10:32 AM

I needed a quick and easy method of temporarily closing my live site to all visitors apart from myself.  I searched and found the following.

Create a new page called 'maintenance.html' and upload it to your sites root folder.  Do not include any images, but add whatever text you like and preferably add a time when the site will be back online.  This just helps keep your customers informed.

Add to the start of your root folders htacess file

# MAINTENANCE-PAGE REDIRECT
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>

Change the part of the code that is in red to your ip address keeping the \.  and save the changes.

Now you should be able to access your site, whilst sending all other visitors to your maintenance page.

This worked for me so i thought i would share.
REMEMBER BACKUP, BACKUP AND BACKUP
I am not a coder, so dont bother sending PMs asking for help as you wont get any.  

OSC has a steep learning curve, but in general the program does work.  If it doesnt work, the chances are it is something you have done.

#2   geoffreywalton

geoffreywalton

    Contact me for Support

  • Community Sponsor
  • 8,036 posts

Posted 04 February 2012 - 10:44 AM

There are several more sophisticaled down for maintenance/ holiday/vacation add-ons which you can enable from the admin page but the above will work too!!

Cheers

G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#3   Robbogeordie

Robbogeordie
  • Members
  • 55 posts

Posted 01 March 2012 - 03:36 AM

You can have problems with Google indexing your maintenance page as a replacement for your correct page if you use a 302 redirect.

You are best to use a 503 Service Unavailable status code.

http://www.webmasterworld.com/apache/4326464.htm