Question about http to https redirects

Hi,
This may be splitting hairs, but I have a client request.

If a user enters example.com into their browser, there are a couple rounds of requests (result of running curl -v -L):

301 Moved Permanently 
Issue another request to this URL: 'https://example.com`

then later,

Issue another request to this URL: 'https://www.example.com/'

They would like example.com to go directly to https://www.example.com

I believe I can accomplish this in my _redirects file with:
http://example.com/* https://www.example.com/:splat 301!

This does indeed make the initial request to the https://www

I just want to make sure that I’m not missing anything here, about this process or otherwise.

I tested on a test domain and it appears to work.

1 Like

The easiest way I can think of is using Netlify DNS for your custom domain:

More info here: Custom domains | Netlify Docs

Thanks very much, @tomrutgers. However, that doesn’t get me what I’m trying to accomplish. The default setting, whether or not you’re using Netlify DNS, is two redirects, and I want to get it to one.

I think what I want to accomplish is pretty straightforward; I just want to make sure—before I put this in production—that there are no gotchas that I’m unaware of.

Hi @budparr, your redirect is good and won’t cause any problems. Thanks for sharing :slightly_smiling_face:

1 Like