Skip to main content

Redirect Domains

Matt Gray avatar
Written by Matt Gray
Updated over a week ago

The number of Primary Domains that a Servd project can use is limited, but often a project will have multiple domains that only need to redirect to a Primary domain and do nothing more. We call these 'Redirect Domains' and you can add as many as you need to the Servd Platform.

Adding a Redirect Domain

  1. Visit the Project Settings > Domains page in the Servd dashboard.

  2. In the Redirect Domains panel, use the 'Add a Redirect Domain' form to enter a Domain (where you'd like to redirect from) and a Redirect To value (where you'd like to redirect to).

  3. Click 'Add'

  4. Copy the IP address shown within the details at the top of the Redirect Domains panel. Add this as a DNS 'A' record to the domain being redirected.

  5. Wait a few moments for the DNS update to propagate, then click the Validate DNS button next to the redirect domain in the list.
    ​

  6. Once the DNS has been confirmed, a new SSL certificate will be generated and your domain will begin redirecting straight away.

Redirect Domains and Cloudflare

Proxying a redirect domain via Cloudflare will prevent our DNS validation from completing - you will see an error stating that AAAA records are set for the domain. In this situation you can either:

1. Disable cloudflare proxying on the domain, wait two minutes, then perform the validation again

2. Set up your redirect in Cloudflare instead! You can use a Cloudflare Page Rule, set to use a Forwarding URL. This allows you to safely remove the Redirect Domain from Servd.

Maintaining The Original Request Path

If you supply a 'To' value without any path portion included (no forward slashes other than in the protocol `://`) the path from the original request will be automatically maintained for the redirect.

If you include a path in your 'To' value (including if you only supply a single `/`) the original request path will be dropped from the redirect.

If you need to maintain the original request path, but want to prefix it with a new subpath, you can do so by including `$uri` in your 'To' value. This will be expanded to the path from the original request, including a leading slash.

For example, a To value of `https://mynewdomain.com/old-content$uri` can be used to map all of an old domain's URLs over to the /old-content path under a new domain.

Did this answer your question?