# Vercel でサブディレクトリを設定する

{% 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*"
        }
    ]
}
```

*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/ja-gitbook-documentation/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.
