Forwarding www.yourdomain.com to yourdomain.com from cPanel

To automatically redirect traffic from www.yourdomain.com to yourdomain.com, you can add the following code to your website’s .htaccess file:

 
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^yourdomain\.com RewriteRule (.*) http://yourdomain.com/$1 [R=301,L]

Instructions:

  1. Access your hosting account's File Manager via cPanel or connect via FTP.

  2. Locate the .htaccess file in the root directory of your website (usually public_html).

  3. Paste the above code at the top or appropriate section of the file.

  4. Replace yourdomain and com with your actual domain name and extension.

Example:
If your domain is example.net, the last two lines would be:

 
RewriteCond %{HTTP_HOST} !^example\.net RewriteRule (.*) http://example.net/$1 [R=301,L]

Why Combine www and non-www URLs?

Redirecting all traffic to a single URL version (either with or without "www") helps with:

  • Improved SEO & PageRank: Prevents search engines from treating www and non-www versions as separate sites.

  • Consolidated Traffic: All visitors are directed to a single domain version, avoiding traffic and link juice being split between URLs.

Ця відповідь Вам допомогла? 0 Користувачі, які знайшли це корисним (0 Голосів)