Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Quick and Easy Maintenance Mode

When moving a website between servers it’s usually a good idea to put the website into Maintenance Mode, which displays a message to any visitors telling them to check back soon, and also ensures we can transfer the most up to date database and files to the new server before making the switch.

Some content management systems come with a Maintenance mode built in, or have plugins you can install to do the job. However, if you’re looking for an alternative, or not using a CMS with the functionality built in, this quick .htaccess solution does the job very nicely.

First off, create a new html page called maintenancemode.html in the root of your website. You can design this page however you like and include whatever message is required. Then put the following in your .htaccess file:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenancemode\.html$
RewriteRule ^(.*)$ http://website.com/maintenancemode.html?utm_source=rss&utm_medium=rss [R=307,L]

This rewrite rule forwards the user to maintenancemode.html when they try and access any page on your site. It does so using code 307 which means the redirect is to a temporary page and itsn’t a permanent change in URL.

The post Quick and Easy Maintenance Mode appeared first on CodeBastard.



This post first appeared on CodeBastard, please read the originial post: here

Share the post

Quick and Easy Maintenance Mode

×

Subscribe to Codebastard

Get updates delivered right to your inbox!

Thank you for your subscription

×