How to redirect your root domain to www
Table of Contents
Why redirect the apex to www?
Some setups serve your site on the www hostname (for example when your platform issues the TLS certificate for www.example.com via a CNAME). In that case the bare root domain — the apex, like example.com — has nowhere to go on its own, so you redirect it to the www address. Visitors who type either version end up in the right place, and you keep a single canonical URL (which is also better for SEO).
The redirect is set up at your domain registrar / DNS provider, not in Staticbot. Below are precise steps for the most common providers. The pattern is always the same: remove any conflicting record on the root (@) host, then add a permanent (301) URL redirect from the apex to https://www.yourdomain.com.
Hosting an app on Staticbot? Registrar URL-redirects only work over HTTP for the root domain (see the HTTPS note below). For a proper https:// apex → www redirect, use nameserver delegation in the Staticbot deployment page — we host your DNS, set up the apex → www redirect automatically with a valid certificate, and import your existing records (email included). This page is for the general registrar-redirect case.
1. NamecheapHTTP apex only
Sign in and open Domain List → Manage → Advanced DNS. First delete any existing record on the @ host that would conflict (A record, ALIAS/ANAME, or an old URL Redirect). Click Add New Record and choose "URL Redirect Record" as the type. Set Host to @, set the Value to your full destination (https://www.example.com), and choose Permanent (301) as the redirect type. Save all changes.
Namecheap URL redirects answer on HTTP only — see the HTTPS note below.
- Help Article: Namecheap URL Redirect Guide
2. GoDaddyHTTPS apex supported
Open your Domain Portfolio, select the domain, and go to Domain Settings → Forwarding → Domain → Add. Enter https://www.example.com as the destination, choose Forward type "Permanent (301)" and "Forward only" (not masked). Save. GoDaddy provisions a certificate for the forward, so it also answers on https://.
- Help Article: GoDaddy Domain Forwarding
3. CloudflareHTTPS apex supported
If your domain's DNS is on Cloudflare, use a Redirect Rule (Rules → Redirect Rules → Create rule). Match "Hostname equals example.com", then Dynamic redirect to concat("https://www.example.com", http.request.uri.path) with status 301, preserve query string. You also need a proxied (orange-cloud) DNS record on @ so traffic reaches Cloudflare — an A record to 192.0.2.1 (a dummy, proxied) is the common pattern. Because Cloudflare terminates TLS, this redirect works over https:// too.
This is the most reliable way to redirect an https:// apex.
- Help Article: Cloudflare Single Redirects
4. PorkbunHTTPS apex supported
Open the domain's Details page and find "URL Forwarding". Add a forward from example.com to https://www.example.com, choose type 301 (permanent), leave wildcard off, and enable "include path" if you want deep links preserved. Porkbun issues SSL for the forward, so https:// on the apex works.
- Help Article: Porkbun URL Forwarding
5. Name.comHTTPS apex supported
Sign in, open your domain, and go to "URL Forwarding". Add a forward from the root (example.com) to https://www.example.com, choose Redirect type 301 (Permanent), and save. Remove any conflicting A/ALIAS record on the root first.
- Help Article: Name.com URL Forwarding
6. IONOSHTTPS apex supported
Go to Domains & SSL, select the domain, and choose "Adjust Destination" → "Redirect" (HTTP redirect / domain forwarding). Enter https://www.example.com as the target and pick "Permanent (301)". IONOS provides SSL for the redirect.
- Help Article: IONOS Domain Redirect
7. Squarespace (Google Domains)HTTPS apex supported
Google Domains has migrated to Squarespace Domains. Open the domain, go to DNS / Domain Forwarding, and add a forward from example.com to https://www.example.com with a permanent (301) redirect. Delete any conflicting A record on the root first.
- Help Article: Squarespace Domain Forwarding
8. Bluehost / HostGator (cPanel)HTTPS apex supported
In cPanel open "Domains → Redirects". Choose Type "Permanent (301)", pick your root domain (https?://(www.)?example.com), set "Redirects to" https://www.example.com, and select "Do Not Redirect www" so you don't create a loop. Save. cPanel serves the redirect over both http and https once AutoSSL has issued a certificate.
- Help Article: cPanel Redirects
9. AWS Route 53HTTPS apex supported
Route 53 has no built-in URL redirect. The standard pattern is to create an S3 bucket named example.com configured for "Redirect requests to https://www.example.com", front it with a CloudFront distribution (for HTTPS + an ACM certificate on the apex), then point an ALIAS A record for example.com at that CloudFront distribution. This is more involved than a registrar forward but gives you a proper https:// apex redirect.
- Help Article: S3 Website Redirects
⚠️ Important: HTTPS on the apex
Many registrars' URL forwarding only answers on HTTP (port 80) for the root domain — they can't present a valid TLS certificate for example.com, so a visitor who types https://example.com directly may see a connection timeout or certificate error, even though http://example.com and www.example.com both work. Namecheap's URL Redirect is HTTP-only in this way.
If you need the https:// apex to redirect too (browsers increasingly try HTTPS first), use a provider whose forwarding includes SSL (GoDaddy, Porkbun, IONOS, cPanel AutoSSL) or move the domain's DNS to Cloudflare and use a Redirect Rule — Cloudflare terminates TLS on the apex, so the redirect works over HTTPS. The Route 53 + S3 + CloudFront pattern above achieves the same on AWS.
💡 General Notes
- Delete conflicts first: remove any existing A, ALIAS/ANAME, or old URL-redirect record on the
@(root) host before adding the redirect, or it won't take effect. - Use 301 (Permanent): this is the SEO-friendly, cacheable redirect. Avoid "masked"/frame forwarding — it breaks HTTPS and SEO.
- Don't redirect www: only the apex redirects.
wwwis where your site actually lives. - Propagation: registrar forwarding usually takes effect in minutes but can take up to an hour.
Related: How to add a CNAME record · How to add an ANAME/ALIAS record · How to change your nameservers · Custom domain overview
