Your website open two different URL’s like https://domain.com or https://www.domain.com and you want to open URL with www so use simple code on htaccess.
Code for redirect WWW
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Code for redirect non-www
RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
Paste given code on root folder’s .htaccess file and SAVE it