> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.faaaster.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How do I add a redirect or an nginx rule on Faaaster?

To redirect an address or add your own nginx rules, write them in a `conf/server.user.conf` file, then click **Restart PHP / Nginx** in the **Actions** menu. Faaaster tests the configuration before applying it: an invalid rule is never put into service.

> **Prerequisite** — the **File Editor** (**Access** tab) or SFTP access. The `conf` folder is at the root, next to the `www` folder.

## Redirecting an address

1. Open the site, **Access** tab, **File Editor** section, then the `conf` folder.
2. Create the `server.user.conf` file if it doesn't exist.
3. Add your redirects:

```nginx
# One page to another
location = /old-page/ { return 301 /new-page/; }

# A whole section
rewrite ^/blog/(.*)$ /news/$1 permanent;

# One page to another site
location = /shop/ { return 301 https://shop.example.com/; }
```

4. In the **Actions** menu, click **Restart PHP / Nginx**.

A redirect to a path (`/new-page/`) stays on the domain the visitor requested. To send visitors to another domain, write the full address with `https://`.

## nginx rule files

The `conf` folder accepts two families of rule files. The name is up to you between the prefix and `.conf`:

| File | Where the rule applies |
| --- | --- |
| `server.<name>.conf` (for example `server.user.conf`) | at the server level: redirects, `location` blocks |
| `location.<name>.conf` | in the block that runs WordPress's PHP pages |

These files follow nginx syntax: they're intended for people who know it. To exclude a page from the cache, use `conf/cache.user.conf` instead (see the dedicated article).

## If the restart is refused

**Restart PHP / Nginx** first tests the whole configuration. If there's an error, the restart is cancelled and your site keeps running with the old configuration. The interface then shows "Invalid nginx configuration — restart aborted. Fix the configuration:", followed by the error details returned by nginx. The message stays on screen until you close it: fix the faulty file, starting with the last one you edited. Two `location` blocks for the same address, for example, are refused.

> ⚠️ **Fix or delete the file right away.** If left in place, it would prevent the site from responding after a **Restart server**.

## Good to know

- Copy a file's contents before editing it, so you can roll back.
- The AI assistant can tell you the exact rule to write for your case.

👉 [How do I exclude a page from the cache?](https://help.faaaster.io/en-us/article/exclude-a-page-from-cache-cr2h62/) · [How do I restart my site?](https://help.faaaster.io/en-us/article/restart-your-site-1tp89sn/) · [How do I edit my site's files?](https://help.faaaster.io/en-us/article/file-editor-sswbpe/)