aixlabDocs
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Redirects

Redirect domains or subdomains

If you have an alias domain that only forwards traffic to another domain, you can set up redirects directly within Cloudflare.

  1. Make sure that your alias domain has a proxied that properly resolves DNS queries. You may also want to include a record for the www subdomain.

    Type Name IPv4 address Proxy status
    A @ 192.0.2.1 Proxied
    A www 192.0.2.1 Proxied
  2. Log in to the Cloudflare dashboard and select your account.

  3. Go to Website.

  4. Select the appropriate website.

  5. Go to Rules > Page Rules.

  6. Select Create Page Rule.

  7. Enter a source URL pattern like stop-tihange.eu/.

  8. Under When incoming requests match.

  9. Pick a setting Forwarding URL and select status code 301 - Permanent Redirect

  10. Enter destination URL use $1, $2, etc. for each asterisk used in the source url, e.g. https://www.stop-tihange.org/$2

  11. Save Page Rule

based on cloudflare

At least for HSTS the first redirect from HTTP to HTTPS must be done on the same domain. For that the rule Enforce HTTPS seems not to work correctly, in each zone will be established a first rule as followed.:

  1. http://example.com/ –> https://$1example.com/$2