Skip to content

Deploy or redirect a domain

Learn how to deploy your domains, and set up redirects.

Once the domain has been added to your project and configured, it is automatically applied to your latest deployment.

Note: The first deployment of a new project will be marked as production and subsequently assigned with your custom domain automatically.

When a Custom Domain is assigned to a project that's using Git, each push (including merges) to the Production Branch (commonly main) will trigger a deployment to the defined domain.

Reverts take effect immediately, assigning the Custom Domain to the deployment made prior to the point the revert is effective from.

You can add domain redirects from the Domains tab when more than one domain is present in the project. This provides a way to, for example, redirect a www subdomain to an apex domain, but can be used in a variety of ways.

If a user visits your domain with or without the "www" subdomain prefix, we will attempt to redirect automatically. You might still want to add this redirect explicitly.

To add a redirect, click the Edit button on the domain you want to redirect from and use the Redirect to dropdown to select the domain you want to redirect to:

A domain redirect that redirects requests made to www.acme.com to acme.com.

A domain redirect can be temporary or permanent by specifying a status code.

  • 307 Temporary Redirect - not cached by client, method and body never changed. This type of redirect does not affect SEO and search engines will treat them as normal redirects.
  • 302 Found - not cached by client, method may or may not be changed to GET.
  • 308 Permanent Redirect - cached by client, method and body never changed. This type of redirect does not affect SEO and search engines will treat them as normal redirects.
  • 301 Moved Permanently - cached by client, method may or may not be changed to GET.

We recommend using status code 307 or 308 to avoid the ambiguity of non-GET methods, which is necessary when your application needs to redirect a public API.

Internet Explorer on Windows 8 and older does not support 308 natively, but Vercel supports older browsers by adding a Refresh header.

Adding an apex domain to a Project on Vercel will automatically suggest adding its www counterpart. Using both of these domains ensures that visitors can always access your site, regardless of whether or not they use www when entering the URL.

After clicking "Add" for a domain, you will be able to choose how to redirect the www counterpart:

Choosing redirect options for your apex domain.

We recommend using the www subdomain as your primary domain, with a redirect from the non-www domain to it. This allows the Vercel Edge Network more control over incoming traffic for improved reliability, speed, and security. The redirect is also cached on visitor's browsers for faster subsequent visits.

Some browsers like Google Chrome automatically hide the www subdomain from the address bar, so this redirect may not affect your URL appearance.

Choosing to redirect the www domain to the non-www also works but provides Vercel less control over incoming traffic. Alternatively, you can choose to add only the domain you typed.

Additional technical information about Domain redirects

The DNS spec forbids using CNAME records on apex domains like example.com. They are, however, allowed for subdomains like www.example.com. This is why Vercel recommends primarily using a www domain with a CNAME record, and adding a redirect from the non-www domain to it.

Using CNAME instead of A records ensures that domains on Vercel are fast, reliable, and fault-tolerant. Unlike A records, CNAME records avoid hard-coding a specific IP address in favor of an additional lookup at the DNS level. This means that Vercel can quickly steer traffic in the case of DDoS attacks or for performance optimizations.

While we recommend using www as described above, Vercel maximizes the reliability and performance of your apex domain if you choose to use it as your primary domain by leveraging the Anycast methodology. This means Vercel still supports geographically routed traffic at infinite scale if you use an A record.