Redirecting naked domains with Vercel is a little bit tricky, but not impossible. This short guide will help you set up your redirection:
Visit your domain name provider and find a place where you can add custom nameservers. Select two or more nameservers from the list. If you have and the CNAME record is already pointing to Vercel, please move on to step 02. If the CNAME record does not yet exist or is not redirect to Vercel, please locate your DNS configuration settings in Vercel and copy the details for the CNAME record. The details should then be pasted into the CNAME entry field your domain provider offers.
Please note: The following process takes up quite some time. We built NakedSSL to make the lives of web masters, admins, and web developers a little easier. Use the quick check to find out if NakedSSL is the right choice for your domain. Or just ignore our advertisement, scroll down, and indulge in part two of our tutorial.
Hey, at least we didn't waste your time creating an account. If you made a mistake in your URL, just run the checker again. And if you don't even have a SSL certificate installed, these guides get you started:
You can create an account and get your URL redirected safely with SSL in no time.
If you haven't already purchased a valid SSL certificate for your domain, redirecting from e. g. https://domain.com to https://www.domain.com will not work, because the browser first needs to establish a secure SSL connection before the redirection starts. The redirect therefore fails, as the SSL certificate does not match. If this is the issue you are experiencing, you might want to purchase a valid SSL certificate for both your www and naked domains. After purchasing it, you have to install the SSL certficate it on your server. Here are 2 configurations that will solve the problem:
You could use an if condition in your Nginx configuration, e. g. like this:
server {
listen 443;
server_name domain.com;
if ($host = domain.com) {
rewrite ^(.*) https://www.domain.com:443$request_uri? permanent;
}
Or you could use the following configuration to create a 301 redirect for your naked domain:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.example.com;
====>>> Your site configuration goes here <<======
}
If you are looking for an easy way out, please try NakedSSL. It is quick, easy, and will solve your problem in a couple of minutes — for free.
Start with our free single-domain plan and upgrade only if necessary: NakedSSL offers plans
for all your needs.
Need even more domains? Just contact us.
Our high volume plans include API Access and are especially designed for those that need bigger capacity at an affordable price. Need even more domain redirections? Just contact us to explore our enterprise plans.