How to force redirect www or non-www with cPanel
It is recommended by Google that your site is just open through either www or without www (and NOT both). In that capacity, you should configure a redirect to push one or the other. We give comfort to doing this.
1. Sign in to cPanel
2. Go to 'Nginx Automation' area and select 'CLOUDNS'
3. Select the domain section and click on 'Configure'.
4. Now you will get an option 'Redirections' click on it.
5. Select the preferred choice from the 'www Redirect' dropdown
Click 'Submit'
Note: If you are working on WordPress, you should guarantee your correct domain (with or without www.) is added to the Settings - > General screen.