Do I need a www to non-www redirection code with WP 3.5?
-
I have recently migrated my Joomla site to WP and I am wondering whether the www to non-www redirection code I was using is actually needed anymore.
I have observed that the www. pages are redirected to non-www by defaultHowever, while before – in Joomla days – Google Webmasters tools reported no issue with the www. version of the site, now I am getting errors that it’s not properly indexed.
So I am worried that whatever redirection WordPress is doing may not be that effective on the wholeSO I have just added back the redirect code
########## Begin - Redirect www to non-www ## WARNING: Comment out the non-www to www rule if you choose to use this RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] ## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L] ########## End - Redirect non-www to www
While I had been using this code without trouble, some others were suggesting the following as more appropriate
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ RewriteRule (.*) https://www.example.com/$1 [R=301,L]
What is actually the case?
– Do I need a www. to non-www code in WordPress 3.5?
– If I do, which of the above is the recommended one?Cheers
- The topic ‘Do I need a www to non-www redirection code with WP 3.5?’ is closed to new replies.