Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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 ;)

share|improve this answer
    
This is only possible on a single site WordPress install, not on a MultiSite one. In MultiSite there are no WordPress Address (URL) and Site Address (URL) textboxes. –  Paul T. Sep 15 '12 at 15:34
    
Sorry Paul T. I didn't notice that it's multisite. please visit on this link, may be it's help you: stackoverflow.com/questions/5093654/… –  techguy4web Sep 15 '12 at 15:55
    
Here is one more link: answers.bitnami.org/questions/4587/… –  techguy4web Sep 15 '12 at 15:58
    
I tried both links, and no effect whatsoever :( –  Paul T. Sep 15 '12 at 16:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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