Our Help Portal

Troubleshooting Support Articles
Searchable Help Information Repository
Self-Service Resources How-Tos
Technical Customer Walkthroughs   Browse All Knowledge ! ....

Get Prices Learn More


< All Topics

How to create a site maintenance message with a .htaccess file?

To create a site maintenance message using an .htaccess file, you can use the RewriteRule directive to redirect all requests to a maintenance page while your site is undergoing maintenance. Here’s a step-by-step guide:

  • 1. Create a Maintenance Page:

Create a simple HTML or PHP maintenance page (e.g., maintenance.html or maintenance.php). This page will be displayed to users during the maintenance period.

Example maintenance.html:

<!DOCTYPE html>
<html lang=”en”>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Site Maintenance</title>
body {
text-align: center;
padding: 100px;
font: 20px Helvetica, sans-serif;
color: #333;
<p>We apologize for the inconvenience, but our site is currently undergoing maintenance. Please check back later.</p>

  • Create or Edit the .htaccess File:

Add the following lines to your .htaccess file. If you don’t have an existing .htaccess file, create a new one in the root directory of your website.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance\.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 # Add your IP address for access during maintenance
RewriteRule $ /maintenance.html [R=302,L]

  • Replace maintenance.html with the actual filename of your maintenance page.
  • Update the 123\.123\.123\.123 with your IP address to allow access to the site for specific IPs. This allows you to view the site normally while it’s under maintenance.
  • Testing:
  • Save the changes to your .htaccess file.
  • Access your site to ensure that visitors are redirected to the maintenance page, while your IP is allowed to access the site.

Important Notes:

  • The R=302 in the RewriteRule specifies a temporary redirect. Change it to R=503 for a temporary service unavailable status if the maintenance period is expected to be longer.
  • Once maintenance is complete, remove or comment out the lines added to the .htaccess file to revert to normal site operation.
  • Always make a backup of your .htaccess file before making changes.

By following these steps, you can effectively display a maintenance message to visitors while performing updates or maintenance on your website.