Need to force the "www" on my WP site.
I've set the Wordpress URL and Site URL to both include the www.
I've set the preferred site to the www version in Google's webmaster tools.
Some of my inbound links have www, but most don't.
Some of the links without www will still take the user to the URL with www in it. While others will leave it without. I have no clue why this is, the links themselves definitely point to the non-www version.
Typing in the URL without the www will not forward to the www version.
I tried inserting redirect code I found into my .htaccess and it broke the site (removed it right away of course). I'm using W3 Total Cache which puts a lot of stuff in the .htaccess file. Maybe that's why it broke?
How do I get this sealed up?
EDIT:
Adding all the useful details up here in the first post.
To summarize the behavior:
- Typing in "domain.com" results in "http://domain.com/"
- "domain.com/" results in "http://domain.com/"
- "domain.com/path" results in "http://www.domain.com/path/"
- "domain.com/path/" results in "http://domain.com/path/"
- At least one link pointing to http://domain.com results in "http://www.domain.com/"
- Most or all other links pointing to the same, result in "http://domain.com/"
Also, I guess there is no point in obfuscating the domain. It's my blog, in my signature, if you'd like to see how it behaves yourself.
I'm using the W3 Total Cache plug-in for WordPress. This has some of it's own mod_rewrite stuff in the .htaccess file. Here are the sections of my .htaccess file which have mod_rewrite stuff.
# BEGIN W3TC Page Cache core <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^(.*/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 [L] RewriteCond %{HTTP_USER_AGENT} (2.0 mmp|240x320|alcatel|amoi|asus|au-mic|audiovox|avantgo|benq|bird|blackberry|blazer|cdm|cellphone|danger|ddipocket|doc$ RewriteRule .* - [E=W3TC_UA:_low] RewriteCond %{HTTP_USER_AGENT} (acer s100|android|archos5|blackberry9500|blackberry9530|blackberry9550|cupcake|docomo ht-03a|dream|htc hero|htc magic|$ RewriteRule .* - [E=W3TC_UA:_high] RewriteCond %{HTTP_COOKIE} w3tc_referrer=.*(google.com|yahoo.com|bing.com|ask.com|msn.com) [NC] RewriteRule .* - [E=W3TC_REF:_search_engines] RewriteCond %{HTTPS} =on RewriteRule .* - [E=W3TC_SSL:_ssl] RewriteCond %{SERVER_PORT} =443 RewriteRule .* - [E=W3TC_SSL:_ssl] RewriteCond %{HTTP:Accept-Encoding} gzip RewriteRule .* - [E=W3TC_ENC:.gzip] RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} ="" RewriteCond %{REQUEST_URI} /$ [OR] RewriteCond %{REQUEST_URI} (sitemap.xml(.gz)?) [NC] RewriteCond %{REQUEST_URI} !(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|index.php) [NC,OR] RewriteCond %{REQUEST_URI} (wp-comments-popup.php|wp-links-opml.php|wp-locations.php) [NC] RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|wordpress_[a-f0-9]+|wordpress_logged_in) [NC] RewriteCond "%{DOCUMENT_ROOT}/wp-content/w3tc/pgcache/%{REQUEST_URI}/_index%{ENV:W3TC_UA}%{ENV:W3TC_REF}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -f RewriteRule .* "/wp-content/w3tc/pgcache/%{REQUEST_URI}/_index%{ENV:W3TC_UA}%{ENV:W3TC_REF}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L] </IfModule> # END W3TC Page Cache core # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{http_host} ^domain.com[NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
âAn expert is a person who has made all the mistakes that can be made in a very narrow fieldâ Niels Bohr
FB Ads? Check This 3 Minutes Video!
<=
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
Grab a LIFETIME Discount off Elegant Themes
Grab a LIFETIME 40% Discount off The Best Spinner
[LIMITED ACCESS + FREE ARTICLE INCLUDED OR YOUR OWN]
CLICK HERE NOW
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
[LIMITED ACCESS + FREE ARTICLE INCLUDED OR YOUR OWN]
CLICK HERE NOW
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
The 2nd Amendment, 1789 - The Original Homeland Security.
Gun control means never having to say, "I missed you."
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
Two Signature lines for rent.
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes
Engage Your Website Visitors Using the RIGHT Video Player Plugin! [URL]https://mvp.wpqualityplugins.com//https://mvpplugin.com/URL]
I write engaging & interesting content.
My blog: Online Business Lifestyle
-Kevin Kimes