---
layout: article
title: Redirect a site for maintenance
description: Create Appwrite Firewall rules that send visitors of a site to a maintenance page and back.
difficulty: beginner
readtime: 5
---

A redirect rule sends matching visitors to another location. Use it to put a deployed site into maintenance without a new deployment.

This guide uses two rules on one site. A **bypass** rule keeps the maintenance page itself reachable. A **redirect** rule sends every other path to the maintenance page. Without the bypass rule, requests to the maintenance page would match the redirect rule and loop.

**Keep the maintenance page self-contained**

The redirect rule also catches the CSS, JavaScript, fonts, and images your maintenance page loads, so the page renders unstyled.

Serve a maintenance page with inline styles and no external assets, or add a bypass rule for each asset path at a lower priority number than the redirect.

# Create the bypass rule

1. Open **Firewall** in your project.
2. Click **Create rule**.
3. Enter a **Rule name** (for example `Allow maintenance page`).
4. Set **Resource type** to **Sites** and select your site.
5. Under conditions, set **Path** **Equals** `/maintenance`.
6. Under **Then**, choose **Bypass**.
7. Set **Priority** to `10`.
8. Click **Create rule**.

# Create the redirect rule

![Create firewall rule wizard with redirect settings](/images/docs/firewall/site-maintenance.avif)

1. Click **Create rule** again.
2. Enter a **Rule name** (for example `Redirect to maintenance page`).
3. Set **Resource type** to **Sites** and select the same site.
4. Under conditions, set **Path** **Starts with** `/`.
5. Under **Then**, choose **Redirect**.
6. Set **Redirect location** to `/maintenance`.
7. Keep **Status code** at `302`.
8. Set **Priority** to `100`.
9. Click **Create rule**.

Use `302` so browsers and search engines do not cache the redirect.

# Verify the rules

1. Open any path of the site in a browser. Confirm the browser lands on `/maintenance`.
2. Open `/maintenance` directly. Confirm that the page loads without a redirect and renders with its styles.
3. Open **Firewall** and confirm the **Redirected** series rises in the traffic overview.

# End the maintenance

1. Open **Firewall** and select the site in the resource selector.
2. Turn off the status toggle of the redirect rule.

The site serves normal traffic again. Keep the disabled rule for the next maintenance window, or delete it.

[Resource scopes](/docs/products/firewall/scopes)
