Various web servers such as Apache, supports htaccess file. it is topically a directory-level configuration file. You can use a htaccess file to control your site or configure website-access issues, such as redirect URLs to a new url, URL shortening, access control, and more.
The most popular use of a directory-level configuration file is redirecting you site URLs to HTTPS or HTTP and WWW or non-WWW pages.
This online free tool is a easy tool to generate www or non-www redirection. It generates best suitable htaccess entries as per your requirements.
The htaccess file stars whit a .(dot). The dot makes it hidden from users in Unix-based environments. To unhide htaccess file login to your cpanel, the go to File manager. Now click on settings, now a new window will open. Hare you have check show hidden file option and then click on save button. Now you can view youe (.)htaccess file.
Now when you have access to htaccess file you can easily edit or modify the file and save.
You should always redirect you URLs to whether WWW or non-WWW for better SEO. If you do not set your urls to any one of redirection, search engines counts as two separate URLs. It causes duplicate article issue, so you do not get better ranking.
So you need to set any one redirection as per your requirements.
To set redirection, visit our Htaccess Redirect Generator page, Now Select redirect type between "Redirect from www to non-www" and "Redirect from non-www to www". Then you have to enter your website URL. Now press the Get htaccess Code button.
It will now generate the best code for your site. Copy the generated code and paste it on your htaccess file.
WWW to non-WWW redirection makes your your www URLs to non-www URLs.
For Example:
Site: http://www.example.com
To: http://example.com
non-WWW to WWW redirection makes your your non-www URLs to www URLs.
For Example:
Site: http://example.com
To: http://www.example.com