Site in Maintenance using .htaccess
Redirect your visitor to maintenance page is a must when you are upgrading your site. Now you can redirect your user to maintenance page easily by using .htaccess file. I guess you do not want your visitor to see an error page or 404 page during your server upgrade. So just follow the steps below to create a .htaccess file to redirect your visitor to maintenance page during upgrade:
1- Create a file and name it .htaccess with the content below:
Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !/maintenance.html$ RewriteRule $ /maintenance.html [R=302,L]
2- Once the file is created, put it at your root directory. (This will be in http://www.yourdomain.com/.htaccess)
3- Create another file name it maintenance.html (just put wat messeage you want to show to your visitor during the upgrade) and put it at the root directory too. (This will be in http://www.yourdomain.com/maintenance.html)
Now you can try to browse your site and it should now redirect you to maintenance.html
4- Since you are going to perform the upgrade, you have to able to browse the site. So you have to exclude your IP in the .htaccess file. Now your .htaccess file should look like below.
Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !/maintenance.html$ RewriteCond %{REMOTE_HOST} !^888\.888\.888\.888 RewriteRule $ /maintenance.html [R=302,L]
Your visitor should be redirected to maintenance page by the .htaccess we set just now and you should be able to browse your site and perform your upgrade.
Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details. This .htaccess using apache mod_rewrite module. Please ensure you have mod_rewrite installed and enabled.
From techiecorner
Related Posts- webLab - Create your own php-html lab
- PHP sitemap.xml generator
- Include Javascript file inside another
- Open Classifieds 1.5.3 Released
- rir.li - NO image Hotlinking!
- Top 10 Search Engine Listing And Ranking Tips
- 8 Wordpress Blog Theme Design Considerations
- Kiosk.ws Announce VIP Hosting Franchise
- How To Keep Robots Out Of Your Web Site
- How To Keep Robots Out Of Your Web Site
Help sharing and Flatter me ;)

You might need to put some rules for the images or js files that use the maintenance.html file.
Also, since RewriteCond expects a regular expression, you need to escape the dot (!^/maintenance\.html$)
Regards!
About the DOT, I didn’t need to in my servers yet, good to know anyway.
About the css or js you can use something like this: RewriteCond %{REQUEST_URI} !/mediafolder/(.*)$
thanks and regards ;)