To redirect all www. requests to non-www, add the following directive early on in your .htaccess file. This will force any www. requests to use non-www. using SEO-friendly 301 redirects.
Make sure you switch domain.com with the domain name tied to the hosting (cPanel, Plesk, direct admin, etc). Alternatively, if you do want to force requests to www. add this directive in your .htaccess file.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]
Make sure you switch domain.com with the domain name tied to the hosting (cPanel, Plesk, direct admin, etc). Alternatively, if you do want to force requests to www. add this directive in your .htaccess file.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]