# 使用 Vercel 配置子目录

{% stepper %}
{% step %}

#### 配置你的 GitBook 站点

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

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

在 **附加配置**下，你现在会看到一个代理 URL。你将在下一步配置 Vercel 设置时使用它。将它复制到剪贴板。
{% endstep %}

{% step %}

#### 更新你的 vercel.json

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

```json
{
    "rewrites": [
        {
            "source": "/docs",
            "destination": "<INSERT YOUR PROXY URL FROM GITBOOK>"
        },
        {
            "source": "/docs/:match*",
            "destination": "<INSERT YOUR PROXY URL FROM GITBOOK>/:match*"
        }
    ]
}
```

*请务必更新 URL* 第 5 行上的代理 URL，使用你在第一步中从 GitBook 获取的代理 URL。
{% endstep %}

{% step %}

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

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


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
