Using www and non-www domains with an SSL certificate
Ce contenu n’est pas encore disponible dans votre langue.
When you install an SSL certificate, it’s important to ensure that it works for both versions of your domain:
https://example.com(non‑www)https://www.example.com(www)
If only one version is covered, visitors may see browser security warnings when accessing the other.
Why This Matters
Section titled “Why This Matters”- Many SSL certificates are issued for a single domain (e.g.,
www.example.com). - Visitors who type
example.comwithout thewwwprefix may encounter errors if the certificate doesn’t cover both. - Ensuring both versions are secured improves trust and avoids confusion.
Solutions
Section titled “Solutions”1. Order a Certificate Covering Both Versions
Section titled “1. Order a Certificate Covering Both Versions”- When generating your CSR (Certificate Signing Request), include both
example.comandwww.example.com. - Many providers issue certificates that automatically cover both.
2. Use a Wildcard SSL Certificate
Section titled “2. Use a Wildcard SSL Certificate”- A Wildcard SSL secures all subdomains of a domain.
- Example:
*.example.comcoverswww.example.com,mail.example.com, etc. - Note: Wildcards do not cover the root domain (
example.com) unless explicitly included.
3. Redirect Traffic with .htaccess (Apache/LiteSpeed)
Section titled “3. Redirect Traffic with .htaccess (Apache/LiteSpeed)”If your certificate only covers one version, redirect visitors to the secured version:
RewriteEngine OnRewriteCond %{HTTPS} onRewriteCond %{HTTP_HOST} !^www\.RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] This ensures all traffic is redirected to the www version with SSL enabled.4. Configure in cPanel/WHM
Section titled “4. Configure in cPanel/WHM”- In cPanel → Domains, enable Force HTTPS Redirect for both
wwwand non‑www versions. - In WHM, configure Apache to handle both hostnames under the same SSL certificate.
Cette page vous a-t-elle aidé ?
Merci pour votre retour.