{"id":6877,"date":"2023-06-22T09:31:39","date_gmt":"2023-06-22T09:31:39","guid":{"rendered":"https:\/\/infinitivehost.com\/knowledge-base\/?p=6877"},"modified":"2023-06-22T09:43:47","modified_gmt":"2023-06-22T09:43:47","slug":"redirect-www-or-non-www-url","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/redirect-www-or-non-www-url\/","title":{"rendered":"How To Redirect www Or Non www Url With .Htaccess File Via cPanel?"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 1,598<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>The www and non-www URLs for your domain can be made to redirect people to each other. In the.htaccess file, a cPanel user can add a directive to redirect from www to non-www URLs or the other way around. Keep reading to know more.<\/p>\n\n\n\n<p><strong>STEPS :-<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Login to cpanel.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"334\" height=\"308\" src=\"https:\/\/infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img1.png\" alt=\"www Url\" class=\"wp-image-6879\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img1.png 334w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img1-300x277.png 300w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Now find the \u201cFILES\u201d section and click on \u201cFILE MANAGER\u201d option.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"546\" height=\"209\" src=\"https:\/\/infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img2-1.png\" alt=\"www Url\" class=\"wp-image-6880\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img2-1.png 546w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img2-1-300x115.png 300w\" sizes=\"(max-width: 546px) 100vw, 546px\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>In the File Manager, make sure you&#8217;re in the public_html directory or the root directory of your website.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"638\" height=\"200\" src=\"https:\/\/infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img3.png\" alt=\"www Or Non www Url\" class=\"wp-image-6881\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img3.png 638w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img3-300x94.png 300w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>In the \u2018public_html\u2019 directory, right click on \u201c.HTACCESS\u201d file and choose the \u201cEDIT\u201d option.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"329\" src=\"https:\/\/infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img4.png\" alt=\"www Or Non www Url\" class=\"wp-image-6882\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img4.png 645w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img4-300x153.png 300w\" sizes=\"(max-width: 645px) 100vw, 645px\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Now add the following lines in the .htaccess file. And save it.<\/li>\n<\/ul>\n\n\n\n<p>( Note \u2013 Replace the domain.com, to you desired domain name )<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"118\" src=\"https:\/\/infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img5.png\" alt=\"www Or Non www Url\" class=\"wp-image-6883\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img5.png 438w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/06\/www-img5-300x81.png 300w\" sizes=\"(max-width: 438px) 100vw, 438px\" \/><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>1,598 Views The www and non-www URLs for your domain can be made to redirect people to each other. In the.htaccess file, a cPanel user can add a directive to redirect from www to non-www URLs or the other way around. Keep reading to know more. STEPS :- ( Note \u2013 Replace the domain.com, to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[61],"tags":[110,109],"class_list":["post-6877","post","type-post","status-publish","format-standard","hentry","category-cpanel","tag-redirection","tag-urlredirect"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/6877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=6877"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/6877\/revisions"}],"predecessor-version":[{"id":6885,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/6877\/revisions\/6885"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=6877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=6877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=6877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}