A naked domain, also known as a bare domain, is a domain name without the www prefix. Non-www domains are often preferred for simplicity, but sometimes the www prefix is necessary, such as when integrating with a Content Delivery Network (CDN). Allowing access to both www and non-www URLs can lead to complications.

If both versions of the domain are accessible, it may cause SEO issues, as search engines might treat them as different sites. This can split the search rankings and confuse users. To avoid this, it's important to redirect one version to the other.

In cPanel, you can configure these redirects to control whether users access the site via www or non-www. This setup ensures a consistent domain structure, improving search engine indexing and user experience.

Steps to redirect www to non-www or vice versa in cPanel:

  1. Log in to your cPanel account.
  2. Navigate to the Domains section and select Redirects.
  3. Choose the redirection type from the dropdown.

    This is usually Permanent (301) for permanent redirects or Temporary (302) for temporary redirects.

  4. Select the domain you want to redirect from the list.
  5. Leave the path field blank.

    This ensures the redirect applies to the entire domain.

  6. Enter the full URL including http(s) and www in Redirects to field.

    Enter the domain without www if you're redirecting www traffic to non-www (bare/naked).

  7. Select Do Not Redirect www. in www. redirection option.

    This is to exclude already-www traffic to also be redirected

    Select Only redirect with www. if you're redirecting www traffic to non-www (bare/naked).

  8. Enable Wild Card Redirect if needed.

    This passes the full path of the request to the target URL.

  9. Click Add to apply the changes.
  10. Verify the generated .htaccess file in the public_html directory.

    .htaccess is a hidden file. Enable Show Hidden Files (dotfiles) in the File Manager settings to see it.

Discuss the article:

Comment anonymously. Login not required.