Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

あるドメインから別ドメインへリクエストをリダイレクトする

廃止した HTTP サービス(ポート 80)を除き、機能を保ったまま、すべてのリクエストを別ドメインへ送るリダイレクトルールを作成します。

最終更新 Markdown で表示Agent セットアップ

この例では、元のドメインを別のドメインに置き換えています。HTTP サービス(ポート 80)を廃止した点を除き、機能は保っています。

次の設定で リダイレクトルールを作成 します。

受信リクエストが次に一致する場合

  • Wildcard pattern
    • Request URL: http*://example.com/*

その場合

  • Target URL: https://example.net/${2}
  • Status code: 301
  • Preserve query string: 有効

この設定は、次のようにリダイレクトします。

リクエスト URL リダイレクト後の URL ステータスコード
http://example.com/ https://example.net/ 301
https://example.com/ https://example.net/ 301
https://example.com/my/path/to/page.htm https://example.net/my/path/to/page.htm 301
https://example.com/search?q=term https://example.net/search?q=term 301

役に立ちましたか?