Last Reviewed by Netlify Support Staff: May 2024
So you need to take your site offline for maintenance. Netlify enables a great workflow for this! We suggest using a either a manual deploy (aka Drag and drop) or a special maintenance branch in your repository so you don’t have to do any heavy lifts like remove all files from your normal production branch in case you use our continuous deployment system.
To use either of those paths, you’ll start by creating some static HTML that displays your maintenance message. You can of course use graphics and other asset types, but you don't need more than this: <html>Our site is down for maintenance</html>
in a single index.html
file deployed at the root of your site. Note that this will temporarily REMOVE FROM SERVICE all the rest of the files and redirects on your normal deploy until you later re-publish a production deploy again, so if you have mission critical things like a manifest, or redirects that should still be active despite maintenance, you must include them with this deploy! You might want to put a wildcard redirect in place too, something like /* /index.html 302
that will make all pages show the maintenance message.
To deploy manually:
- Put all of that content into a folder, let’s call it
maintenance
. - Drag that folder to your deploy listings on the site you want to put under maintenance. This will publish the maintenance page as a new deploy.
- After previewing the content, use the button to publish this deploy.
To deploy via Git:
- Instead create a branch called e.g.
maintenance
with the content you wish to have live in it. - Update your Build & Deploy settings to also build this
maintenance
branch. You can add it to the list of allowed branches if you don’t already allow all branches to be built. - Next, successfully deploy this branch (it will be a Branch Deploy).
- After previewing the content, use the button to publish this deploy.
Following up from either method:
- When maintenance is done, navigate to the previous production deploy from your deploys listing and choose to publish it again with the button there. No need to change code - you just choose the old deploy to republish by selecting the deploy, and on its logs page, use the “publish deploy” button to roll back to this deploy.
- Future deploys via your normal channel (whether that is Git commits, CLI, API, or drag and drop) will work as usual going forward.