[Support Guide] What’s the easiest way to create a temporary “maintenance page” for my site?

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:

  1. Put all of that content into a folder, let’s call it maintenance.
  2. 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.
  3. After previewing the content, use the button to publish this deploy.

To deploy via Git:

  1. Instead create a branch called e.g. maintenance with the content you wish to have live in it.
  2. 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.
  3. Next, successfully deploy this branch (it will be a Branch Deploy).
  4. After previewing the content, use the button to publish this deploy.

Following up from either method:

  1. 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.
  2. Future deploys via your normal channel (whether that is Git commits, CLI, API, or drag and drop) will work as usual going forward.
5 Likes

One of the easiest “maintenance” workflows ever!

4 Likes

@fool It is still publishing on my main production branch instead. Please would you expound on point 3 & 4. I’m following this - to deploy via git. I’ve added the maintenance branch in my deploy settings (deploy context) and deployed the brunch (step 3). Thanks

You would need to:

  • create a different branch in git
  • create the maintenance page on that branch
  • see the branch deploy logs in our deploys listing, in our UI
  • publish that deploy with the “publish this deploy” button there
  • then use the “lock publishing to this deploy” button
  • then other commits will not be published at your production URL until you unlock.

Great, thanks! This sorted me out :slight_smile:

1 Like

I’m using a nextjs site and when I try to deploy my maintenance branch, the build fails, because it’s “auto-detecting” nextjs and loading the nextjs plugin.

Anyone know how to get around this? Also, tried the manual deploy, but dragging and dropping a folder on the deploy listing page does nothing. What am I missing?

Hi @cjboco :wave:t6: , welcome to the forums!

Can you try to configure your deployment to ignore the auto-detection of Next.js in your deploy settings and instead use a manual configuration. This will allow you to specify that you’re deploying from a maintenance branch and avoid any conflicts with the automatic detection.

I actually went ahead and just created a bare minimum next.js site for the maintenance branch, as I was under time constraints… but I did see this option in the Netlify settings after I did this.

I will try to deploy it again manually and see what happens. Would be nice to have this setting branch based.