Redirecting naked domain to www in a proper way technique

hi everyone, what’s the most appropriate way to redirect naked domain http://example.com|example.com to http://www.example.com|www.example.com?

depends on your web server, but in general:

  1. add A and optionally AAAA records to the apex domain (http://example.com|example.com) with your server’s IP(s)
  2. when you get an HTTP request to the apex domain, serve a 302 or 301 redirect to http://www.example.com|www.example.com with the same path and query params

for app engine specifically, the docs have the IPs to use. you’ll want to add http://example.com|example.com as a custom domain in the cloud console, and probably get an SSL cert for it too