简体   繁体   中英

Naked domain on Google Sites New

I've been messing with my DNS settings and can't figure out how to get this to work...

I have G Suite for example.com , with a (new) Google Sites app published and accepting www.example.com . I have a CNAME in my DNS pointing www to Google, so http://www.example.com/ and https://www.example.com/ both work, with the http one doing a 301 to the https version, which is exactly what I want.

In my DNS (at GoDaddy), I have the base domain redirecting to https://www.example.com - so requests to http://example.com get forwarded properly.

The one leftover is https://example.com/ - that one does not redirect because GoDaddy doesn't support it (I'd assume all hosting companies would be the same), but I want it to redirect like the others.

The only way I can think of is to have a live hosting account somewhere else, for https://example.com/ , and have that redirect the browser over to www . I could do that with a static hosting (like Firebase) and use javascript, or app hosting with something like ASP.NET, and redirect directly in the response.

Is there an easier way, without using a separate hosting product?

(This might be a better question for ServerFault, but I figure I'd start here)

Since even in the G Suite console address mapping is supported only by HTTP and not HTTPS , I only see one way - you can use Cloudflare for this.

This is a proven solution, I use it myself. This works because Cloudflare is effectively able to "see" your HTTPS traffic.

  1. You change the NS servers for your domain to the NS servers that are assigned to your Cloudflare account.
  2. Re-create all DNS records in Cloudflare.
  3. Use this small hack .

However, I recommend using 301 response code for such a redirect, not 302 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM