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.


Answer: Don't disable it, use it to do the redirection you want.

  • If you have a subdomain install, then you cannot do this at all, the www is a subdomain.

  • If you have a sub-directory install and want all the sites to be www, then edit your wp-config.php and change the DOMAIN_CURRENT_SITE to be your www domain.

  • If you are using domain mapping, then use the domain mapping plugin to change the domain to have a www in it.

In the latter two cases, the point is that you're not using .htaccess to do the redirection, you're letting WordPress do the redirection to what it expects the URL is supposed to be.


login to admin and check go to General settings

check WordPress Address (URL) and Site Address (URL) textbox. perhaps here URL stored without www so add www before yours domain name in either both WordPress Address (URL) and Site Address (URL)

hope this helps you. all the best ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.