How to disable the default WordPress redirect to non-www URLs?
-
03-11-2019 - |
Question
I am trying to redirect all non-www to www URLs in my WordPress MultiSite install. I am using a simple .htaccess
rule like this:
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Normally this would work, however WordPress already seems to have a default redirection to non-www URLs. This means that when I use that RewriteRule
it causes an infinite redirect loop.
How do I disable this?
PS. I tried define('NOBLOGREDIRECT', 'http://www.domain.com');
in wp-config.php
with no effect.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange