79311281

Date: 2024-12-27 08:24:27
Score: 1
Natty:
Report link

For these types of stuff, redirecting www to apex domain and redirecting http to https, it can be achieved via DNS provider.

For example, if you are using Cloudflare, you can make the follwing redirect rules.

Redirect www to apex

When incoming requests match
  Wildcard pattern
    Request URL: https://www.*
Then
  Target URL: https://${1}
  Status code: 301
  Preserve query string: Enabled

Redirect http to https

If incoming requests match: 
  Wildcard pattern
    Request URL: http://*
Then:
  Target URL: https://${1}
  Status code: 301
  Preserve query string: Enabled

The actual implementation might vary depending on your DNS provider.

References:

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: reynaldi