コンテンツにスキップ

リダイレクト

URL転送、またはURLリダイレクトとも呼ばれるものは、特定のHTTPステータスコードを使用して、ユーザーをソースURLからターゲットURLに移動させます。

使用ケースに応じて、以下のCloudflare製品を使用してURLリダイレクトを実行します:

  • シングルリダイレクト: ゾーンレベルで静的または動的リダイレクトを作成することを可能にします。ワイルドカードサポートを備えたシンプルなインターフェースにより、複雑な関数や正規表現を必要とせずに、ソースとターゲットのURLパターンを簡単に定義でき、1つのルールで数千のURLを効率的にカバーします。

  • バルクリダイレクト: アカウントレベルで多数のリダイレクトを定義することを可能にします。これらのURLリダイレクトは基本的に静的であり、文字列置換操作や正規表現をサポートしていません。ただし、リダイレクトのURLマッチング動作や実行時動作に影響を与えるパラメータを設定できます。

  • スニペット: 複雑なリダイレクト機能を定義するためのより柔軟な方法として、短いJavaScriptコードの断片を使用します。始めるためのいくつかのを考慮してください。

リダイレクトルールテンプレート

Cloudflare provides you with rules templates for common use cases. In the dashboard, go to your zone > Rules > Templates and select one of the available templates. You can also refer to the Examples gallery in the developer docs.

利用可能性

シングルリダイレクトとバルクリダイレクトはすべてのCloudflareプランで利用可能です。正確なクォータと機能は、プランによって異なります。

バルクリダイレクト

Free Pro Business Enterprise

Availability

Yes

Yes

Yes

Yes

Bulk Redirect Rules

15 15 15 50

Bulk Redirect Lists

5 5 5 25

URL redirects across lists

20

500

500

10,000

_リスト間のURLリダイレクト_について、この表はエンタープライズプランのデフォルトクォータを提供します。バルクリダイレクトは数百万のURLリダイレクトをサポートしており、より多くのリダイレクトが必要な場合は、アカウントチームに連絡してください。

バルクリダイレクトの機能とクォータはアカウントごとに異なり、アカウントの最高Cloudflareプランに依存します。

シングルリダイレクト

Free Pro Business Enterprise

Availability

Yes

Yes

Yes

Yes

Number of rules

10 25 50 125

Wildcard support

Yes

Yes

Yes

Yes

Regex support

No

No

Yes

Yes

シングルリダイレクトの機能とクォータはゾーンごとに異なり、ゾンプランに依存します。

実行順序

The execution order of Rules features is the following:

The different types of rules listed above will take precedence over Page Rules. This means that Page Rules will be overridden if there is a match for both Page Rules and the Rules products listed above.

Generally speaking, for non-terminating actions the last change made by rules in the same phase will win (later rules can overwrite changes done by previous rules). However, for terminating actions (Block, Redirect, or one of the challenge actions), rule evaluation will stop and the action will be executed immediately.

For example, if multiple rules with the Redirect action match, Cloudflare will always use the URL redirect of the first rule that matches. Also, if you configure URL redirects using different Cloudflare products (Single Redirects and Bulk Redirects), the product executed first will apply, if there is a rule match (in this case, Single Redirects). Refer to the Phases list for the product execution order.

Troubleshooting

When troubleshooting URLリダイレクト, use Cloudflare Trace to determine if a rule is triggering for a specific URL.