Tuesday, 10 October 2017 14:36

    How to create Redirect non-www to www using htaccess

    Written by
    Rate this item
    (1 Vote)

    Technically speaking, both www and non-www are 2 different websites and as such may be penalised by search engines for duplicated content. From an SEO perspective it is always best practice to redirect your non-www site URL to www or your wwww. to your non-www version.

    Our site www.accrodigital.com, for example, has a redirection from non-www (http://accrodigital.com) to www (http://www.accrodigital.com). In other, everytime anyone type http://accrodigital.com will be redirected to www.accrodigital.com. Note the "www" in the second URL.

    Technically, the non-www version and the www version are two different domains. So redirecting one to the other improves our SEO. Google and other search engines won't have to worry about two different domains.

    This tutorial will show you how to redirect your whole website to either non-www or www.

    Please note that you will need to find and access your htaccess file. It is located at the root of your website server.

    1. Locate the following line within your htaccess file

    RewriteEngine On

    2. To redirect non-www to www, add this code below it:

    RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

    3. To redirect www to non-www, add this code after RewriteEngine On:

    RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

    I hope that this tutorial will help you. Please leave your comment below if any.

    Read 8380 times Last modified on Wednesday, 11 October 2017 07:54
    Fabien Bello

    Fabien Bello has been working in web and app develoment since 1997. He has held numerous positions from game developer to head of creative and product development for major firms such as Xerox, Gala Coral Group. Fabien continues contributing to online community, owns and manages several websites as well as offering consultancy to all size businesses.


    • Comment Link PeterHop Friday, 15 January 2021 16:32 posted by PeterHop

      where to get viagra jsbuuwxx buy viagra online generic viagra
      ed meds online http://canadarx24.online/ cheapest ed pills online qykyzhzx
      free cialis medication for providers cialis online cialis ingredient

    • Comment Link FgnhSmert Friday, 15 January 2021 10:08 posted by FgnhSmert

      viagra shipped overnight viagra online australia paypal professional viagra cheap generic viagra viagra sell viagra patent ends viagra natural para hombres viagra super force online 100 mg viagra viagra online united states viagra off patent date how much does viagra cost? viagra no prescrition viagra online store review brand viagra

    • Comment Link ChesterUneva Friday, 15 January 2021 08:08 posted by ChesterUneva

      mexican viagra https://edcheapgeneric.com/ mxheetcu cost of viagra

    • Comment Link PeterHop Friday, 15 January 2021 06:47 posted by PeterHop

      is generic cialis safe generic cialis online gnpuoopa real cialis online with paypal
      treatment for erectile dysfunction http://canadarx24.online/ ed medicine ivhnhmxr
      cialis vs viagra cheap cialis cialis canada

    • Comment Link DavidWab Friday, 15 January 2021 03:16 posted by DavidWab

      diabetes and ed http://canadarx24.online/ best ed medication twcldzer

    • Comment Link Jvcxjorma Thursday, 14 January 2021 01:08 posted by Jvcxjorma

      п»їviagra online viagra forum viagra generic 100mg cheap generisches viagra paypal pfizer viagra 100mg buy viagra in canada toronto viagraaustralia viagra 4 packs viagra from canada viagra over night shipping viagra sydney genuine how to buy viagra from canada viagra online south africa belize viagra i want viagra

    • Comment Link Davidjab Wednesday, 13 January 2021 11:57 posted by Davidjab

      male erection pills https://canadarx24.com/ ed drugs compared

    • Comment Link KhthSync Wednesday, 13 January 2021 08:47 posted by KhthSync

      erectile dysfunction pills thrifty drug store canadian pharmacies online

    • Comment Link ThomasWer Wednesday, 13 January 2021 07:47 posted by ThomasWer

      otc ed pills https://canadarx24.com/
      ed treatment

    • Comment Link ThomasWer Wednesday, 13 January 2021 05:14 posted by ThomasWer

      impotence pills https://canadarx24.com/
      male dysfunction

    Leave a comment

    Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.