# How To Create And Manage Site Rules With xCloud?

> Learn how to Create and Manage Site Rules in xCloud to control HTTP headers and redirects without editing server files.

Site Rules lets you create and manage HTTP header rules and redirect rules for your WordPress site directly from the xCloud dashboard — no server files to edit. xCloud tests your server's configuration before it keeps a rule. If the test fails, the rule isn't saved and your site keeps running as it was.

_📢 Site Rules replaces the older Redirection page for WordPress sites. Create new redirects in **Tools → Site Rules**. Your older redirects keep working, and you can view or delete them under **Domain → Redirection (Legacy)**. See [How to set up redirects](/docs/set-up-redirection-in-xcloud/) for the full walkthrough._

Site Rules works on both Nginx and OpenLiteSpeed servers.

## What Are Site Rules?

Site Rules lets you control two things: the headers your site sends and where old addresses go.

-   **Header Rules:** Add, modify, or remove HTTP response headers (e.g., security headers like X-Content-Type-Options, Strict-Transport-Security, custom headers for caching or CDN behavior)
-   **Redirect Rules:** Create 301/302 redirects with optional conditions based on hostname, URI, query string, or device type — with no server files to edit

Rules are processed in the order listed. To change it, drag a rule by its handle, then click **Save Order**.

Each site can have up to 10 header rules and 25 redirect rules.

## Prerequisites

-   A paid xCloud plan (Site Rules is not available on the free plan)
-   A WordPress site on an Nginx or OpenLiteSpeed server

_⚠️ It is also not available for non-WordPress applications (**Laravel, custom PHP, Node.js, etc.**)._

## **Step 1: Open Site Rules**

Open your site, then go to **Tools → Site Rules** in the left sidebar.

![Click 'Site Rules' under Tools in the site sidebar](/_landing/docs/how-to-create-and-manage-site-rules-image-99.png)

## **Step 2: Choose a Rule Type**

Next, you will find the two tabs:

-   **Header Rules**: for managing HTTP response headers
-   **Redirect Rules**: for managing URL redirects. On OpenLiteSpeed servers this tab is called **Redirect / Rewrite Rules**.

Click the tab for the type of rule you want to create.

![Choose the 'Header Rules' or 'Redirect Rules' tab](/_landing/docs/how-to-create-and-manage-site-rules-image-100.png)

## Step 3: Create a Header Rule

On the **Header Rules** tab, click **Add Rule** at the top right. The **Create Header Rule** form opens.

![Click 'Add Rule' on the Header Rules tab](/_landing/docs/how-to-create-and-manage-site-rules-image-104.png)

Fill in the following:

| Field | Description |
|---|---|
| **Type** | Pick a ready-made security header, or **Custom** to write your own. |
| **Action** | **Set** adds the header. **Unset** removes it. On Nginx, a Site Rule set to **Unset** doesn't remove the X-XSS-Protection header in our test, so use the [Remove X-XSS-Protection header switch](/docs/how-to-add-custom-security-headers-in-xcloud/#remove-the-x-xss-protection-header). |
| **Header Name** | The HTTP header name (e.g., X-Content-Type-Options, Cache-Control). Use letters, numbers and hyphens, and start with a letter. |
| **Header Value** | The value to set for the header (e.g., nosniff, no-store). Only shown for **Set**. |
| **Always Apply** | **True** adds the header to every response. **False** adds it only to successful responses. Not shown on OpenLiteSpeed, where headers always apply to all responses. |

Click **Save Rule**. xCloud tests your server's configuration before it keeps the rule. If the test fails, the rule isn't saved and you see an error message.

![Click 'Save Rule' in the Create Header Rule form](/_landing/docs/how-to-create-and-manage-site-rules-image-98.png)

## **Step 4: Create a Redirect Rule**

Switch to the **Redirect Rules** tab, then click **Add Rule**. The **Create Redirect Rule** form opens. On OpenLiteSpeed servers, this form is called **Create Redirect / Rewrite Rule**.

![Click 'Add Rule' on the Redirect Rules tab](/_landing/docs/how-to-create-and-manage-site-rules-image-101.png)

Fill in the following:

-   **Action:** **Permanent Redirect (301)** or **Temporary Redirect (302)**. OpenLiteSpeed servers also offer **Rewrite (Internal)**, which shows other content without changing the address.
-   **Source Pattern:** The path to redirect from (e.g., ^/old-page$ or /old-page)
-   **Destination:** The full URL or path to redirect to (e.g., /new-page or https://example.com/new-page)
-   **Keep Query String:** **Yes** keeps anything after the ? in the old address. **No** drops it.

Click **Save Rule** to add the redirect rule.

To check the rule without saving it, click **Test Rule**.

![Click 'Test Rule' to check a redirect before saving it](/_landing/docs/how-to-create-and-manage-site-rules-image-103.png)

You can also add conditions. For example, you can redirect mobile users to a different URL, or redirect only when a specific query argument is present.

Turn on **Attach Condition**, then choose the **Condition Type** (**Host**, **URI**, **Query Argument** or **Device Code**), the **Operator** and the **Value**.

![Choose the Condition Type, Operator and Value after turning on Attach Condition](/_landing/docs/how-to-create-and-manage-site-rules-image-97.png)

## **Step 5: Edit or Delete a Rule**

Click the three dots in the rule's **Actions** column, then choose **Edit** or **Delete**.

**Edit** opens the same form with the existing values filled in. Make your changes and click **Update**.

**Delete** asks you to confirm with **Yes, Delete**, then removes the rule.

![Click the three dots in the Actions column, then choose Edit or Delete](/_landing/docs/how-to-create-and-manage-site-rules-image-102.png)

## Do it with the API or MCP

You can also create, update and delete Site Rules from the xCloud Public API or an AI agent connected to xCloud MCP. The same configuration test applies, and a rule that fails it isn't saved. See [Manage Site Rules with the xCloud Public API and MCP](/docs/manage-site-rules-with-xcloud-public-api-and-mcp/). Testing and reordering rules stay in the dashboard.

## **Troubleshooting**

-   **Site Rules** does not appear in the sidebar. → Check that the site is WordPress on an Nginx or OpenLiteSpeed server. If you're a team member, ask your team admin whether your role can manage Site Rules. On the free plan, the link opens the billing page instead.
-   **Saving a rule shows Configuration test failed. Site Rule was not saved.** → Your site isn't affected. Check the header value or redirect pattern for a mistake and try again.
-   **A header rule is saved but the header does not appear in the browser.** → Check the Header Name for a typo. If **Always Apply** is **False**, the header is only added to successful responses.
-   **A redirect isn’t triggering.** → Test in a private window. If you added a condition, check its value. Also check for a rule higher in the list, or an older redirect, that catches the same address.
-   **I hit the rule limit but need more rules.** → Each site can have 10 header rules and 25 redirect rules. Delete rules you no longer need, or combine similar redirects into one pattern.
-   **Test Rule shows success but the live rule isn’t working.** → **Test Rule** only checks that your server accepts the rule, not that it does what you want. Open the old address in a private browser window, or run `curl -I https://example.com/your-page` and look for `301` or `302`.
