Non Www version not Redirecting to Www version in WordPress [Solution]

We all know that WordPress is a SEO friendly Blogging platform . One thing which WordPress takes care of intelligently is by directing non www to Www version or vice versa, depending upon your settings under general tab.

I have my settings set to direct non www version of site to Www & this happens automatically. (WordPress handles it).

Now here is a bug which I have spotted couple of days back that after updating my blog to latest 3.1, non www version of site is not redirecting to Www version. This seems like a big issue when we consider SEO.

After little bit of hit and trial, I realize issue is with my cache plugin (W3 total cache). If I disable caching, WordPress handles this redirection else on activation of cache plugin, it fails. Finally I landed into this thread from WordPress forum and found the solution.

If you happen to fall in the same situation, simply move your WordPress redirects above the codes added by W3 total cache in your .htaccess file.

Your redirection code will be something like this:

   1: # BEGIN WordPress

   2: <IfModule mod_rewrite.c>

   3: RewriteEngine On

   4: RewriteBase /

   5: RewriteCond %{REQUEST_FILENAME} !-f

   6: RewriteCond %{REQUEST_FILENAME} !-d

   7: RewriteRule . /index.php [L]

   8: </IfModule>

   9:

  10: # END WordPress

Once you have moved your code above code added by W3 total cache, clear your cache and check if redirection is happening or not. If everything seems to be fine, it’s time to grab a coffee. 🙂

If you are using W3 total cache plugin, don’t forget to check your redirection status.

Was this helpful?

Thanks for your feedback!
Authored By
A Blogger, Author and a speaker! Harsh Agrawal is recognized as a leader in digital marketing and FinTech space. Fountainhead of ShoutMeLoud, and a Speaker at ASW, Hero Mindmine, Inorbit, IBM, India blockchain summit. Also, an award-winning blogger.

18 thoughts on “Non Www version not Redirecting to Www version in WordPress [Solution]”

  1. Odira

    I’m having the same issue now but I’m using a rocket caching plugin, how do I solve the problem please?

  2. Tejpal Choudhary

    Thanks Harsh, Finally redirection problem solved.

  3. Sufyan

    Hey harsh thanks works like charm

  4. Shaurya Kharb

    Hello Harsh,
    I am facing this problem too after update.
    And I am not even using any Cache plugin for now. But still my site is not directing from non-www to www
    My WordPress Url and Site Address is same with http://www in start.
    Please Help

    1. Shaurya Kharb

      Hey I solved it but i did it with adding simple code in .htaccess file.
      Its :

      RewriteEngine On
      RewriteBase /
      RewriteRule ^index.php$ – [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      RewriteCond %{HTTP_HOST} ^viralindians.com
      RewriteRule (.*) http://www.viralindians.com/$1 [R=301,L]

  5. Kulwant Nagi

    Solved like a charm.. I was trying to solve this issue for last 4-5 days..

    Big thanks.. 🙂

  6. Bhuwan Roka

    Hi !
    I want the site working without entering www infront of abc.com.
    For eg: I am trying to view the site like this: abc.com but there is default web page not a website.

    Anyone help me would be great.

    Thanks

  7. Jon

    I was having the same problem too. I started deleting plugins one by one. When I deleted Yoast’s WordPress SEO the problem resolved. Could not see a setting in WordPress SEO which was breaking the redirect. Also, the homepage of the non-www version was out of date. No caching on either. Odd. Also, I only saw this problem when not logged in.

  8. Niklank @ ITMagazine

    Harsh this is my first comment in your blog, actually I have setup a new blog in which I am going to provide all IT and SEO related information. Well here I want thank you for this non WWW to WWW redirection issue, I got solution for my blog. Thanks Again.
    Nik

  9. Yousuf Khan Jee

    I am having WWW blog and have no problem. Everything is working smoothly!

  10. Sandeep@Curious Little Person

    what about backlinks harsh.. lets say ive built up backlinks to www and non http://www.. do i get credit for both .. or do we have to use a 301 permanent redirect to the preferred version..

    I was always under the assumption that you need to use 301 permanent redirect to get the credit for backlinks

    for the preferred domain , you can use google webmasters as well to set the one you prefer as well..

    would love to hear your views..

  11. Rakesh Kumar

    I haven’t upgraded my blog into Version 3.1 yet but i have saved this tip for later reference. Thanks Harsh

  12. Sathish @ TechieMania

    I am using Total cache for my blog and I tried the redirection just now. It is working perfectly. Seems this bug affected only few users.

  13. Himanshu

    i have a www blog. no problems in there as yet.

  14. Deepanshu

    i had this problem some days ago in mozilla but the support staff of bluehost rectified the problem:-)

  15. Usman@FirstHosting

    I’ve read the same issue happening with some on on the forum, I will ask him to visit a solution here.

    thank for a share.

  16. Antim Grahan

    Let Me try in My Blog Too. I m using Latest Version of Wp

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top