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

Creating an .htaccess file on your DreamHost web server

View the following article for instructions on how to create an .htaccess file on your web server:

If the file already exists, view the following articles for instructions on how to update it (depending on if you're using an FTP client or SSH):

Pointing your site to the maintenance page

If your site is going into maintenance, you can forward visitors to a maintenance message automatically. First, you must create a file named 'maintenance.html' in your web directory.

View the following articles for instructions on how to create a file.

Then, add the following to your .htaccess file:

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule .* /maintenance.html [L]

If you now visit the site, it automatically loads the contents of the maintenance.html file, but the URL does not change.

You can replace [L] with [R=307,L] if you prefer that the user see the URL change to example.com/maintenance.html. However, this is usually not what you want.

See also

Did this article answer your questions?

Article last updated .