Total WordPress Optimization • Search Engine Optimization • WordPress & SEO •  WordPress security • PPC • Psychology • WordPress Design • WordPress Installation
www redirect to no www - Printable Version

+- Total WordPress Optimization • Search Engine Optimization • WordPress & SEO • WordPress security • PPC • Psychology • WordPress Design • WordPress Installation (https://totalwpoptimization.net)
+-- Forum: Total WordPress Optimization (https://totalwpoptimization.net/forumdisplay.php?fid=19)
+--- Forum: Easy WebSite Using WordPress (https://totalwpoptimization.net/forumdisplay.php?fid=106)
+---- Forum: Setting up WordPress before you start building (https://totalwpoptimization.net/forumdisplay.php?fid=91)
+---- Thread: www redirect to no www (/showthread.php?tid=172)



www redirect to no www - Michelle - 12-18-2013

To minimize load times (save a DNS lookup) do this

Redirecting www to non www or vice versa.

Redirect from non-www to www

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


Redirect from www to non-www

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



Or the HTTPS version:

Redirect from www to non-www

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]



Redirect from non-www to www

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]



Use the first if you decided your domain is http://www.yourdomain.com and the second if you decided your domain is http://yourdomain.com

And in WordPress settings set the url according to your decision.

It doesnt matter which yoy choose, but it maters that you make a choice!


RE: www redirect to no www - Falk - 12-27-2013

Thanks ! I have tried a number of different things but this must be the fastes way to redirect :-)


RE: www redirect to no www - john.89.oning - 01-16-2016

Thanks for the instructions! Really useful Smile


RE: www redirect to no www - Jonzz - 11-21-2016

Thanks for sharing this. I was also looking for a good way to do this. Really useful.