> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/publish/custom-domain/setting-a-custom-subdirectory/configuring-a-subdirectory-with-vercel.md).

# 使用 Vercel 配置子目录

使用 Vercel 通过 /docs 子目录托管你的文档

{% stepper %}
{% step %}

#### 配置您的 GitBook 站点

在 GitBook 组织中，点击侧边栏中的文档站点名称，然后点击 **管理站点**，接着点击 **域名和重定向**。在“子目录”下，点击 **设置子目录**.

输入您要托管文档的 URL。然后指定用于访问文档的子目录，例如 `tomatopy.pizza/docs`，然后点击 **配置**.

在 **其他配置**下方，您现在会看到一个代理 URL。下一步配置 Vercel 设置时会用到它。请将其复制到剪贴板。
{% endstep %}

{% step %}

#### 更新您的 vercel.json

在你的 Vercel 应用中，打开 `vercel.json` 文件（如果还没有该文件，请在根目录中创建一个）。然后添加以下内容：

```json
{
    "rewrites": [
        {
            "source": "/docs",
            "destination": "<从 GITBOOK 插入您的代理 URL>"
        },
        {
            "source": "/docs/:match*",
            "destination": "<从 GITBOOK 插入您的代理 URL>/:match*"
        }
    ]
}
```

*请务必更新第 5 行中的 URL* ，将其替换为第一步中从 GitBook 获取的代理 URL。
{% endstep %}

{% step %}

#### 重新部署您的应用并试用一下！

使用更新后的配置重新部署你的 Vercel 应用。这可能需要几分钟。现在，访问该 URL 时，你应该会看到你的文档站点。
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/zh/publish/custom-domain/setting-a-custom-subdirectory/configuring-a-subdirectory-with-vercel.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
