The following tutorial will teach you how to redirect website to WWW. this trick will only take 10 seconds. WWW is also very important in website ranking, SEO, User trust etc…

Is WWW good for SEO?
WWW has always be the main role on our site not only WWW improves the website performance but also improving the SEO in search engine.
So It’s upon you to activate WWW on your site and you know when visiting any site we always check WWW status on other site so it enhance the user experience and google always recommended to activate WWW on our site.
How to Enable WWW on WordPress?
Not wasting our time let’s jump to the main solution on how to enable WWW on wordpress site URL.
To move your site to WWW, find your .htaccess file on your cPanel (file manager) -> Open your .htaccess file.

Swipe down at the end you can see </IfModule> line just above paste this given code and don’t forget it change the site address.
Firstly put your site URL how I have shown in this code
- On the second link add your domain name like: yourdomainname.com
- On the third line add https://www.yourdomainname.com
RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomainname.com [NC] RewriteRule ^(.*)$ https://www.yourdomainname.com/$1 [L,R=301]
Copy the given code and paste on the above of </IfModule> tag before click on save button read the next line.

Before you click on the save changes button on file manager first come to your wordpress Dashboard -> Settings -> General.
At last Add WWW on your WordPress Address & Site Address afterwards again come to the file manager and click save and secondly click save changes on your wordpress settings.
How to Connect GoDaddy Domain to Hostinger
If you face error then it must be because of wordpress setting unless you don’t provide WWW to site address and wordpress address you will still face error again and again.

Redirect WWW to Non WWW
Similarly For those who wanted to redirect www to non-www, use this given code:
RewriteEngine On RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
The code is same you only need to change the direction of your site url.
Conclusion
Finally We have finished this tutorial, we have learned How to Redirect WordPress site to WWW and for those who wanted to redirect WWW to non WWW both the method has shown For those beginners who find it difficulty to redirect wordpress site to WWW so they can use this trick and solve your problem.