keep track of your website visitors during the maintenance downtime

1 Comment

Follow the steps below to put your website under maintenance

Step-1: Create a ‘website under maintenance’ web page and name it as 503.php. Put following PHP code at the very top of the page before the <html> tag:
<?php
header(“HTTP/1.1 503 Service Temporarily Unavailable”);
header(“Status: 503 Service Temporarily Unavailable”);
header(“Retry-After: 3600″);
?>

This code will return 503 response header which tells the search engine that your website is temporarily unavailable. The ‘Retry After’ parameter tells the search engines to try to crawl the website after 3600 seconds (or 1 hour).
Note: Google also recommends returning 503 status code when your website is under maintenance.
Also insert Google Analytics tracking code in the head section of the 503.php page to keep track of the website visitors during the downtime.

Step-2: Add following lines of code at the top, in your .htaccess file:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^111.111.111.111
RewriteCond %{REQUEST_URI} !/503.php$ [NC]
RewriteRule .* /503.php [R=302,L]

The code in the .htaccess file will redirect all the pages on your website to the 503.php page. So no matter what page a visitor access on your website, They will be automatically redirected to the 503.php page.

Da Miracle is a full service Design & Digital marketing agency based in Kolkata, India offering magical designs and logical digital strategies. A one stop shop for creating your identity, promoting it and solutions to keep your customer happy.

About us and this blog

We are a full service agency that deliver compelling digital marketing solution. Our winning solutions and experience helps to deliver great results across several key areas.

Request a free quote

We offers professional SEO services that help websites increase organic search drastically and compete for 1st page rankings of highly competitive keywords.

More from our Blog

View all projects
1 Comment
    • Amar
    • December 20, 2014
    Reply

    Very useful when its a planned downtime and something which we should keep in mind but ignore.

Leave a Comment

twenty − twelve =