---
title: "pols sites"
description: "List and manage published sites"
---

<!-- Generated by scripts/reference.mjs from the pols CLI's --help. Do not edit; run `npm run reference:sync`. -->

A site is a static directory published from a sandbox, like a build's dist/,
and served by pols at https://\<name\>.on.pols.so: it stays up while the sandbox
is in standby, stopped or deleted. Every publish is a new version that never
changes; a site keeps its newest 10 (pols sites set `--keep`) besides the live
one, and pols sites restore makes an older one live again.

Sites are private: only your org's users, logged in at my.pols.so, can open
them. With `--access` link anyone with the site's share link can, with
`--access` public anyone. Leaving link access invalidates the share link.

Publish with `pols publish [SANDBOX] DIR`. Without a subcommand, list the sites.

## Usage

```text
pols sites [flags]
pols sites [command]
```

## Subcommands

| Command | Description |
| --- | --- |
| [`pols sites get`](#pols-sites-get) | Show a site and its versions |
| [`pols sites import`](#pols-sites-import) | Make a site built from a GitHub repository and deploy it |
| [`pols sites link`](#pols-sites-link) | Print a link site's share link, or replace it |
| [`pols sites ls`](#pols-sites-ls) | List the org's sites |
| [`pols sites redirects`](#pols-sites-redirects) | Redirect old paths of a site to new ones |
| [`pols sites restore`](#pols-sites-restore) | Make a kept version of a site live again |
| [`pols sites rm`](#pols-sites-rm) | Delete a site and all its versions |
| [`pols sites set`](#pols-sites-set) | Change who may open a site, how many versions it keeps or where it redirects |

## Flags

```text
-h, --help   help for sites
```

## pols sites get

Show a site and its versions

### Usage

```text
pols sites get SITE [flags]
```

### Flags

```text
-h, --help   help for get
```

## pols sites import

A site imported from a GitHub repository (pols sites import) is built by
deploys: pols fetches the commit into a build sandbox of your org, runs the
project's install and build commands there, publishes the output as the
site's new live version and deletes the sandbox. The build is billed as
sandbox time. Pushes to the site's branch deploy again by themselves; your
org builds one deploy at a time, so the others wait as queued.

Import REPO (owner/name), one the GitHub accounts connected to your org let
pols read, as a new private site and queue its first deploy of the
repository's default branch. The build settings are detected from the
project's files. Without `--name` the site is named after the repository.
Connect GitHub accounts on the account page at my.pols.so.

### Usage

```text
pols sites import REPO [flags]
```

### Examples

```sh
pols sites import acme/website
pols sites import acme/website --name launch
pols deploys log launch --follow   # watch the build
```

### Flags

```text
-h, --help          help for import
    --name string   the site's name (default: the repository's name)
```

## pols sites link

Print the share link of a site with link access: anyone with it can open the
site, so treat it like a password. `--rotate` replaces it; the old link and
every visit opened with it stop working.

### Usage

```text
pols sites link SITE [flags]
```

### Flags

```text
-h, --help     help for link
    --rotate   replace the share link; the old one stops working
```

## pols sites ls

List the org's sites

### Usage

```text
pols sites ls [flags]
```

### Flags

```text
-h, --help   help for ls
```

## pols sites redirects

A site's path redirects answer requests for given old paths, like
/2013/01/11/hello-world/ or /?p=12, with a redirect (301, or 302) to a new
path on the site or an absolute http(s) URL, while the site keeps serving
its files. A rule without a query matches its path whatever the query; one
with a query only that query, its parameters in any order. A trailing slash
does not matter, and the request's query is not carried over. A site has at
most 5000 rules; they belong to the site, so publishing keeps them.

### Usage

```text
pols sites redirects [command]
```

### Subcommands

| Command | Description |
| --- | --- |
| [`pols sites redirects get`](#pols-sites-redirects-get) | Show a site's path redirects |
| [`pols sites redirects set`](#pols-sites-redirects-set) | Replace all of a site's path redirects |

### Flags

```text
-h, --help   help for redirects
```

### pols sites redirects get

Show a site's path redirects

#### Usage

```text
pols sites redirects get SITE [flags]
```

#### Flags

```text
-h, --help   help for get
```

### pols sites redirects set

Replace all of a site's path redirects with the rules in a JSON file (- reads
stdin): a list of \{"from": "/old/", "to": "/new/", "status": 301\}, status
301 (the default) or 302, or the \{"redirects": \[...\]\} that get `--json`
prints. An empty list removes them.

#### Usage

```text
pols sites redirects set SITE --file RULES.json [flags]
```

#### Examples

```sh
pols sites redirects set my-blog --file rules.json
echo '[{"from": "/?p=12", "to": "/hello-world/"}]' | pols sites redirects set my-blog --file -
echo '[]' | pols sites redirects set my-blog --file -
```

#### Flags

```text
    --file string   the JSON file of the rules; - reads stdin
-h, --help          help for set
```

## pols sites restore

Make a kept version of a site live again

### Usage

```text
pols sites restore SITE VERSION [flags]
```

### Examples

```sh
pols sites restore my-docs 3
```

### Flags

```text
-h, --help   help for restore
```

## pols sites rm

Delete a site and all its versions; it stops being served at once. Its name stays your org's, so you can use it again.

### Usage

```text
pols sites rm SITE [flags]
```

### Flags

```text
-h, --help   help for rm
```

## pols sites set

Change a site's access (private: your org's users; link: anyone with its
share link; public: anyone) or how many versions it keeps besides the live
one (1 to 100; lowering it drops the oldest at once). Leaving link access
invalidates the share link: switching back gives a new one.

`--redirect` URL makes every host of the site, its custom domains included,
answer with a redirect to URL (301, or `--redirect-status` 302) instead of its
files, for everyone its access lets in. The URL is used as it is: the
request's path and query are dropped. It must be an absolute http or https
URL that is not on one of the site's own hosts. `--redirect` "" removes it.

### Usage

```text
pols sites set SITE [flags]
```

### Examples

```sh
pols sites set my-docs --access link
pols sites set my-docs --keep 3
pols sites set old-shop --redirect https://shop.example.com/ --redirect-status 302
pols sites set old-shop --redirect ""
```

### Flags

```text
    --access string         private, link or public
-h, --help                  help for set
    --keep int              how many versions to keep besides the live one, 1 to 100
    --redirect string       redirect every request to this http(s) URL instead of serving files; "" removes the redirect
    --redirect-status int   the redirect's status, 301 (the default for a new redirect) or 302
```

The [global flags](/docs/reference/cli/#global-flags) work with this command too.
