Why Would You Want HTTPS?
When your website uses HTTPS, the connection between your website and the visitor is secured with encryption. Even if you don't consider this important yourself, internet browsers do. They display a warning when a website is offered over HTTP instead of HTTPS. This can make visitors distrust your website and choose not to visit it.
Why Redirect WWW to Non-WWW (or Vice Versa)
It's better to make a choice between offering your website with or without WWW to a visitor. It's possible to have both options active simultaneously, but this can lead to strange situations. Some search engines might consider them as two different websites, or an infinite redirect loop could occur between the WWW and non-WWW versions of a page.
Then there's the question of whether to choose with WWW or without WWW. There's no real reason to choose one over the other besides personal preference. I always omit the WWW because it takes more effort/time to type, so I prefer to keep it as short as possible.
That being said, I always communicate my own website with WWW to clearly indicate that it's a website (www.roose.digital). However, this is mainly because I have a unique top-level domain (.digital), and it's not always immediately clear that it's a website. Since I have set up a redirect to non-WWW, visitors automatically end up on roose.digital.
An SSL Certificate
Before we begin, it's important to have an SSL certificate. This enables an HTTPS connection to your website. You can obtain one for free through Let's Encrypt, among other options. Setting up an SSL certificate is a technical task. Fortunately, most hosting providers offer Let's Encrypt as a standard service, such as Cloudways.
Step by Step
- Install the HTTPS and WWW Redirect module and enable it
- Navigate to Configuration > HTTPS and WWW Redirect or use the following URL /admin/config/system/httpswww
- Turn on 'Enable redirects'
- Choose the option under 'Domain WWW prefix' that suits your preference. As described above, I choose 'Remove WWW prefix'
- For 'HTTP Secure (HTTPS) redirect,' select 'Redirect to HTTPS'
- Click on 'Save configuration'
Your website should now automatically redirect all HTTP and WWW traffic to HTTPS without WWW.
Do you have any questions about the above? Let me know by leaving a comment below.