Many customers in some cases ask for their site address to be forced / redirected, some ask from www to non-www and vice versa. For example, when a visitor types www.bundet.com, it is automatically directed to bundet.com, or wants the opposite. There are many opinions regarding SEO issues. However, I will not discuss that opinion, except for the technical redirect using the .htaccess file via cPanel Manager.
Step1
Login to your hosting cPanel.
Step2
Look for the Files category and click the File Manager icon.
Step3
Click Settings in the upper right corner.
Step4
Select the document root for the domain you are working on and make sure it is checked, next to it is hidden files, check that too. Then click save.
Step5
Find the .htaccess file and right-click on it, a menu will appear, select edit.
Step6
You will immediately be directed to a text editor like notepad. Please fill in the code below, after finishing don't forget to save it / CTRL + S. Make sure "example.com" has been replaced with your domain.
Note! Choose one code you want, not all! if you don't want to deal with ERROR!
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
Now, test by typing in your browser either with www or non-www. Congratulations!