Redirecting apex domains, wildcard domains, and subdomains

You can use the Redirect traffic to www subdomains setting to redirect traffic for apex domains, wildcard domains, or subdomains to a www subdomain so that users always arrive in a consistent location. For example, you could redirect requests from example.com and users.example.com to www.example.com.

Prerequisites

Before you redirect traffic to a www subdomain, you must add the domain to your Fastly service and update the domain's DNS records to point to Fastly. For example, to redirect example.com to www.example.com, you would add example.com to your Fastly service and create a DNS A record to point that domain at Fastly.

Adding the redirects

To redirect traffic for an apex domain, wildcard domain, or subdomain, follow the steps below:

  1. Log in to the Fastly web interface.
  2. From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
  3. Click Edit configuration and then select the option to clone the active version.
  4. Click Settings.
  5. In the Redirect traffic to www subdomains area, click Add apex redirect.
  6. From the Domains menu, select the apex domain, wildcard domain, or subdomain you want to redirect.
  7. From the Status menu, select the HTTP status code to send when redirecting traffic from the domains you selected.
  8. Click Add.
  9. Repeat these steps for any other apex domains, wildcard domains, or subdomains you want to redirect.
  10. Click Activate to deploy your configuration changes.
Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.