www to non www (vice versa) resolv are not running in parallel
I was using woorank.com, a website analysis tool to analyzed a site(I’m sorry, I changed the real domain name to xxxx.com to protect it) when I found out that their Website Compliance report said “Be careful! Your website without www doesn’t redirect to www (or the opposite). It’s duplicate content!”
It showed “Be sure that http://xxxxx.com and http://www.xxxxx.com are not running in parallel.
Redirecting requests from a non-preferred hostname is important because search engines consider URLs with and without “www” as two different websites.
Once your preferred domain is set, use a 301 redirect for all traffic to your non-preferred domain.” after I had clicked the plus(+) sign
I didn’t know what made them. I did setup the site correctly. Some people think that’s important. Google and most search engine doesn’t like duplicate content.
I found this tool name Server Header Checker Tool via Google.
This tool will show you whether the 301 redirect is being provided by the server. This is what a search engine will see when it visits the site. The result could be like the following :
Server Response: http://example.com
HTTP Status Code: HTTP/1.1 301 Moved Permanently
Date: Wed, 14 Mar 2007 22:49:28 GMT
Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
Location: http://www.example.com/
Connection: close
Content-Type: text/html; charset=iso-8859-1
#2 Server Response: http://www.example.com/
HTTP Status Code: HTTP/1.1 200 OK
Date: Wed, 14 Mar 2007 22:49:28 GMT
Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
Connection: close
Content-Type: text/html
Above results from non www to www redirection. Does the result from www to non www same with that? Yes, it does, but look at the bold text above.
That tool showed that www.xxxxx.com redirected to http://xxxxx.com/wp-content/w3tc/pgcache/_default_.html.gzip. This url created by W3 Total Cache. I deactivated the W3 Total Cache to see the outcome. Website Compliance report said otherwise,”Perfect! Your website with or without www redirects to the same page!”
I activated the W3 Total Cache again, it showed “ ”Be careful! Your website without www doesn’t redirect to www (or the opposite). It’s duplicate content!”"
I found a solution after I had done few tweaks.. I added directives to .htaccess, put it as first directive, that means put it into the top of .htaccess file, before the W3 Total Cache directives (W3 Total Cache installation required their own directives added to .htacces)
What directives? below directives to redirect www to non www,
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule (.*) http:/example.com/$1 [R=301,L]
Note change example.com with your domain name
Now, “Perfect! Your website with or without www redirects to the same page!”.
