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 10644 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.

    410 comments

    • Comment Link Trariut Monday, 15 March 2021 17:37 posted by Trariut

      http://vskamagrav.com/ - kamagra chewable 100 mg canada

    • Comment Link Kgooevins Wednesday, 10 March 2021 11:58 posted by Kgooevins

      sildenafil online buy sildenafil online how long does it take for sildenafil to take effect

    • Comment Link Geraldsnili Wednesday, 10 March 2021 06:42 posted by Geraldsnili

      prescription drugs without a doctor buy prescription drugs
      generic drugs without doctor's prescription: https://genericwdp.com/ buying prescription drugs from canada
      prescription drugs without a doctor best online international pharmacies india

    • Comment Link Geraldsnili Tuesday, 09 March 2021 06:11 posted by Geraldsnili

      medications without a doctor's prescription sildenafil without doctor prescription
      generic pills without a doctor prescription: https://genericwdp.com/ generic pills without a doctor prescription
      drugs without doctor script sildenafil without doctor prescription

    • Comment Link Samuelinith Tuesday, 09 March 2021 02:24 posted by Samuelinith

      buying prescription drugs from canada sildenafil without doctor prescription
      sildenafil without doctor prescription: https://genericwdp.com/ cheap generic drugs from india
      prescription drugs without a doctor drugs without doctor script

    • Comment Link Geraldsnili Monday, 08 March 2021 11:38 posted by Geraldsnili

      meds online without doctor prescription meds without a doctor prescription
      buy medication without an rx: https://genericwdp.com/ generic pills for sale
      overseas pharmacies shipping to usa india pharmacy

    • Comment Link withouthims.com Saturday, 06 March 2021 09:34 posted by withouthims.com

      how to live with erectile dysfunction: https://withouthims.com/# generic viagra sildenafil citrate 100mg
      fda recalls blood pressure medications viagra without ed bragg erectile dysfunction

    • Comment Link www.levitraye.com Thursday, 04 March 2021 17:42 posted by www.levitraye.com

      levitra cialis online

    • Comment Link VincentBrubs Wednesday, 03 March 2021 02:10 posted by VincentBrubs

      viagra vs cialis generic cialis without prescription
      cost of cialis 20mg tablets https://edplsgeneric.com/ high blood pressure and cialis
      lowest price cialis when will cialis go generic

    • Comment Link EUniomb Tuesday, 02 March 2021 22:05 posted by EUniomb

      sildenafil 50 mg coupon: https://viawithoutdctrs.com prostate stimulation for erectile dysfunction
      what do you need to become a medicare home health provider over the counter viagra hollow penis sleeve for erectile dysfunction men

    Leave a comment

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