2

I have Multisite enabled and can only view my site with the www. When I try without the www it sends me to the sign-up page and says

Registration has been disabled.

www.domain.com/portfolio  <-- load correctly
domain.com/portfolio      <-- redirects to sign-up page

I've tried NOBLOGREDIRECT, but nothing changes.

define('NOBLOGREDIRECT', 'http://www.domain.com');

In .htaccess, I've also tried the following with no success.

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

How do I get my site viewable with and without the "www." in the domain?

  • what's on your Settings -> General Settins for: -> WordPress address (URL) -> Site address (URL) check that you don't have www in those two urls – Azizur Rahman Apr 11 '11 at 11:34
  • @Azizur that option doesn't appear in 3.1.2 multisite. – Andrew Apr 27 '11 at 6:59
1

The answer is here: Domain redirect in Wordpress multisite.

You need to use the domain mapping plugin.

http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

A must read http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/

  • 1
    +1, I'm using the domain mapping plugin with subdomain install and the OP's RewriteRule in my apache virtualhost conf. – Andrew May 2 '11 at 2:30
1

@jaysonp, you were really close but in your Rewrite rule you forgot the www.

Add this in your htaccess file right under RewriteEngine On

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

The solution for me was in the end very simple: within the Domain Mapping plugin referenced by Azizur's answer above, I added a new domain without the www and the same site ID as the www version. I unchecked primary. The result is two entries for the same site (in my case site ID 2), as follows:

ID: 2
Domain: www.domain.com
Primary: Yes

ID: 2
Domain: domain.com
Primary: No
0

You don't need to add any codes in htaccess file. There is very easy solution to this. In the 'Network Admin -> Settings -> Domains' page, add both the www. and non-www. versions of the domain, select the box of 'primary' for if you want to mainly use for www. or non-www. and both will be assigned to the website.

0

Actually the fix is very simple. In your Network>Sites list make sure you do not use www. for your subsites' url address. Simply configure each of your subsite url subsite.com instead of www.subsite.com.

Your Answer

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