Monday, 10 July 2017

How To Redirect Non www URL to www URL of Your Domain

Non-www URL and www URL of Your domain are considered different as in terms to Google and other search engines. They are considered as two url format for your site. 

There is need to fix it to prevent duplicate content by redirecting all your domain.com or domain.com/subfolder to www.domain.com or www.domain.com/subfolder

USERS READ 

How To Redirect Non www URL to www URL of Your Domain

This involves editing the .htacess file in the public_html folder or specifying the domain URL whether www.domain.com or domain.com when installing your WordPress software or other scripts.

Method One 

For yourdomain.com to www.yourdomain.com


Login your domain cpanel by visiting yourdomain.com/cpanel
If you are using WordPress WordPress Dedicated Hosting. Click on FILES > File Manager, then navigate to the root folder( ensure Show Hidden Files is ticked).
Next, locate a file called .httaccess and click on it to edit it and edit it as shown below 
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
Change yourdomain.com with your website name. After add it, when someone accesses tohttp://yourdomain.com he/she will be redirected to http://www.yourdomain.com



For yourdomain.com/sub-folder to www.yourdomain.com/subfolder

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} ^/sub-folder/
RewriteRule ^(.*)$ http://www.yourdomain.com/sub-folder/$1 [R=301,L]
Change yourdomain.com with your website name and also sub-folder text with your existing sub-folder name. After add it, when someone accesses tohttp://yourdomain.com/sub-folder he/she will be redirected tohttp://www.yourdomain.com/sub-folder

Method  Two
This involves Redirecting the domain from the Hosting Cpanel.  Login your domain cpanel by visiting yourdomain.com/cpanel
  1. Select the Redirects icon under the Domains area of your cPanel home page.
  2. Keep the Type as the default, Permanent(301).
  3. Select your domain name from the drop down menu on the next line.
  4. In the redirects to text box, type in the full URL of your domain, including www (e.g. http://www.yourdomain.com).
  5. Select the radio button next to Do Not Redirect www.
  6. Click the Add button to add your redirect.


Conclusion 
That's it and you have successfully redirected yourdomain.com to www.yourdomain.com. Now your can submit www.yourdomain.com to Search engines to crawl. 

SHARE THIS

Author:

I am that Tech guy online that loves to Share myTech ideas and latest gadgets reviews online

0 comments:

Your comments will be appreciated and replied on time. Spams will be deleted upon review.
Follow Us Now On Fbk