{"id":2341,"date":"2021-06-29T10:27:58","date_gmt":"2021-06-29T07:27:58","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2341"},"modified":"2022-05-11T13:42:40","modified_gmt":"2022-05-11T10:42:40","slug":"how-to-redirect-non-www-urls-to-www","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-redirect-non-www-urls-to-www\/","title":{"rendered":"How to Redirect Non-WWW URLs to WWW?"},"content":{"rendered":"\n<p><b>Duplicate web content<\/b><span style=\"font-weight: 400;\"> often exists without people knowing about it.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Most people see <\/span><b>https:\/\/www.domain.com<\/b><span style=\"font-weight: 400;\"> and <\/span><b>https:\/\/domain.com<\/b><span style=\"font-weight: 400;\"> as the same page, but search engines don\u2019t\u2014they see them as duplicate content.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Google sees duplicate content as \u201cappreciably similar\u201d content in more than one URL.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The major problem with duplicate content is that <\/span><b>it\u2019s difficult for search engines to decide on the version to include <\/b><span style=\"font-weight: 400;\">in the search index and rank for query results.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">This confusion could<\/span><b> impact search engine rankings negatively.<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">But you could fix this by redirecting all non-www URLs to their www version, and thankfully, here\u2019s how.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Redirecting Non-WWW URLs to WWW<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">You can <\/span><a href=\"https:\/\/www.scalahosting.com\/kb\/how-do-i-redirect-one-domain-to-another-domain-name\/\"><b>create web redirects<\/b><\/a><span style=\"font-weight: 400;\"> by adding some lines of code to your domain .htaccess file\u2014a server configuration file that lets users make quick changes to their server settings. Use this code to redirect<\/span><b> from non-www to www<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">RewriteEngine On<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">RewriteCond %{HTTP_HOST} ^domain.com [NC]<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">RewriteRule ^(.*)$ http:\/\/www.domain.com\/$1 [L,R=301]<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Please <\/span><b>replace <\/b><b><i>domain.com<\/i><\/b><b> on the code<\/b><span style=\"font-weight: 400;\"> with your domain name and save the changes.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Always add your redirect rules below the <\/span><b>RewriteEngine On<\/b><span style=\"font-weight: 400;\"> line, unless you have it already at the top of the .htaccess file.&nbsp;<\/span><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"610\" height=\"130\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image1-15.png\" alt=\"How to Redirect Non-WWW URLs to WWW?, Redirecting Non-WWW URLs to WWW\" class=\"wp-image-2342\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image1-15.png 610w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image1-15-300x64.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure><\/div>\n\n\n\n<p><span style=\"font-weight: 400;\">If you do, then use the code without the <\/span><b>RewriteEngine On<\/b><span style=\"font-weight: 400;\"> line to create the URL redirect.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">RewriteRule ^(.*)$ http:\/\/www.yourdomain.com\/$1 [L,R=301]<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Now follow these steps to <\/span><b>add the rule to your .htaccess file.<\/b><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 1: Log into SPanel&#8217;s User Interface.<br><\/b><\/h3>\n\n\n\n<p>The default login URL is <em><strong>https:\/\/yourdomain.com\/spanel\/<\/strong><\/em> (don&#8217;t forget to replace <em>yourdomain.com <\/em>with your actual domain).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"453\" height=\"456\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/01\/40.png\" alt=\"How to Redirect Non-WWW URLs to WWW?, Step 1: Log into SPanel&#8217;s User Interface.\" class=\"wp-image-2898\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/01\/40.png 453w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/01\/40-298x300.png 298w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/01\/40-150x150.png 150w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure><\/div>\n\n\n\n<p><b>Step 2: Open the File Manager<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Locate the <\/span><b>FILES<\/b><span style=\"font-weight: 400;\"> section on the homepage and click <\/span><b>File manager.<\/b><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"687\" height=\"178\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image7-11.png\" alt=\"How to Redirect Non-WWW URLs to WWW?, Step 1: Log into SPanel&#8217;s User Interface. 2\" class=\"wp-image-2348\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image7-11.png 687w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image7-11-300x78.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure><\/div>\n\n\n\n<p><span style=\"font-weight: 400;\">Navigate to your domain\u2019s root directory in the file manager and open it.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">If you\u2019re setting up the redirect for your root domain, then the root directory should be the folder named <\/span><b>public_html<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"350\" height=\"448\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image3-15.png\" alt=\"How to Redirect Non-WWW URLs to WWW?, Step 1: Log into SPanel&#8217;s User Interface. 3\" class=\"wp-image-2344\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image3-15.png 350w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image3-15-234x300.png 234w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure><\/div>\n\n\n\n<p><span style=\"font-weight: 400;\">If it\u2019s for a subdomain or <\/span><a href=\"https:\/\/www.scalahosting.com\/kb\/what-is-the-difference-between-addon-domain-parked-domain-and-subdomain\/\"><b>addon<\/b> <\/a><span style=\"font-weight: 400;\">domain, choose the folder bearing its domain name.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 3: Add Your Code<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Locate a file named <\/span><b>.htaccess<\/b><span style=\"font-weight: 400;\"> in the root directory, right-click the file to reveal a menu, then choose <\/span><b>Edit<\/b><span style=\"font-weight: 400;\"> to open the editor.<\/span><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"331\" height=\"489\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image5-12.png\" alt=\"How to Redirect Non-WWW URLs to WWW?, Step 3: Add Your Code\" class=\"wp-image-2346\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image5-12.png 331w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/image5-12-203x300.png 203w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure><\/div>\n\n\n\n<p><span style=\"font-weight: 400;\">Now, <\/span><b>copy and paste your redirect rule<\/b><span style=\"font-weight: 400;\"> into the editor and save. Then, type your URL without the www in your browser to confirm it\u2019s redirecting to <\/span><b>the www version.<\/b><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Need Support?<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">If you need <\/span><b>assistance creating this redirect<\/b><span style=\"font-weight: 400;\">, kindly reach out to <\/span><a href=\"https:\/\/www.scalahosting.com\/contact-us.html\"><b>our support<\/b><\/a><span style=\"font-weight: 400;\"> for quick help, and we\u2019ll be available to help.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Duplicate web content often exists without people knowing about it. Most people see https:\/\/www.domain.com and https:\/\/domain.com as the same page, but search engines don\u2019t\u2014they see them as duplicate content.&nbsp; Google sees duplicate content as \u201cappreciably similar\u201d content in more than one URL.&nbsp; The major problem with duplicate content is that it\u2019s difficult for search engines [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[22],"tags":[],"class_list":["post-2341","post","type-post","status-publish","format-standard","hentry","category-dns"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2341"}],"version-history":[{"count":6,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2341\/revisions"}],"predecessor-version":[{"id":4365,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2341\/revisions\/4365"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}