How to force redirect www or non-www with cPanel

Google recommends that your website should be accessible either with www or without www, but not both. To enforce this, you need to configure a redirect to your preferred version. Follow these steps:

Steps to Set Up the Redirect:

  1. Sign in to cPanel.

  2. Go to the Nginx Automation section and select CLOUDNS.

  3. Choose your domain and click Configure.

  4. Click on Redirections.

  5. From the www Redirect dropdown, select your preferred version (with www or without www).

  6. Click Submit to save the changes.

Note for WordPress Users:

Ensure your preferred domain (with or without www) is correctly set in Settings → General in the WordPress dashboard.