Overview
This article explains how to use an .htaccess file to redirect your website to a maintenance page while it is being worked on.
Redirecting to a maintenance page
The following steps detail the code to place in your website's .htaccess file to redirect to an existing maintenance page.
Create a maintenance page
Create a new file named something like maintenance.html. Add code to this file to display the message you would like visitors to see when they visit your site while it's under maintenance. You can create this file in two ways:
- Create the file on your computer and upload via FTP to your server.
- Log in to your server via SSH and create it on the server.
Create an .htaccess file on your DreamHost web server
See this article for instructions on how to create an .htaccess file on your web server. If the file already exists, use the following articles to update it (depending on if you're using an FTP client or SSH):
Point your site to the maintenance page
Add the following to your .htaccess file. You only need to change the file's name to your maintenance 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.