Staticbot logoStaticbot.dev

    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 a site on Staticbot? If your DNS provider has ALIAS records (Porkbun, Namecheap, Squarespace, Hostinger, Route 53, or Cloudflare’s flattening), you don’t need a redirect: point the root at your site directly (ALIAS guide). Use a redirect when it doesn’t (GoDaddy, IONOS). Not every registrar redirect answers on https:// (see the badge next to each provider); for a guaranteed one, use nameserver delegation: Staticbot hosts your DNS, sets up the root → www redirect with a valid certificate, and copies your existing records (email included) first.

    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 DNS → Forwarding → Add Forwarding. Choose the root domain as the source, enter https://www.example.com as the destination, and pick Permanent (301), forward only (not masked). GoDaddy applies HTTPS to forwarding automatically, so https:// on the apex redirects too. While forwarding is on, GoDaddy locks the @ A record.

    - Help Article: GoDaddy: Forward my domain

    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 not documented

    From Domain Management open Details for the domain and click the edit icon next to URL Forwarding. Leave Hostname blank for the root domain, enter https://www.example.com in Forward Traffic To, leave Wildcard Forwarding off, and open “Toggle advanced settings” to choose a 301 Permanent Redirect (Porkbun defaults to a temporary 302/307) and include the requested path.

    Porkbun’s help doesn’t say whether forwarding answers on https://. Porkbun supports ALIAS records, so on Staticbot you can point the root at your site directly instead.

    - Help Article: Porkbun: How to set up URL forwarding

    5. Name.comHTTP apex only

    Sign in, click My Domains, select the domain and choose URL Forwarding under Domain Actions. Leave the subdomain blank for the root, enter https://www.example.com as the destination, choose Redirect (not Masked), and click Update. Forwarding needs Name.com's default nameservers.

    Name.com's free forwarding answers on HTTP only; https:// forwarding needs its paid Pro tier.

    - Help Article: Name.com: Adding URL forwarding

    6. IONOSHTTPS not documented

    Go to Domains & SSL, select the domain, and click Adjust Destination on the Details tab. Choose Domain Forwarding, pick an arbitrary URL as the type, enter https://www.example.com and choose HTTP redirect (not a frame redirect). The domain must not be in use by a webspace or app at IONOS.

    IONOS's help doesn't say whether the redirect answers on https://. If https://example.com must work, change nameservers instead.

    - Help Article: IONOS: Forward a domain

    7. Squarespace (Google Domains)HTTPS not documented

    Google Domains has migrated to Squarespace Domains. Open the domains dashboard, select the domain and go to Website. Under Domain Forwarding Rules click Add rule, enter @ as the Subdomain, the destination www.example.com (without https://), and choose 301 (permanent). Remove DNS records that point the root somewhere else first, or Squarespace shows an error.

    Squarespace’s help doesn’t say whether forwarding answers on https://. Squarespace supports ALIAS records, so on Staticbot you can point the root at your site directly instead.

    - Help Article: Squarespace: Forwarding a domain

    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, 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. www is 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