How do I map a subdomain in wordpress to the primary domain in a multisite setup?

We have a multisite setup, the primary domain needs to have domain.com, www.domain.com and secure.domain.com mapped in wordpress so the primary site’s content loads on them. The problem we are facing is everything except secure.domain.com works. secure.domain.com always ends up at: http://www.domain.com/wp-signup.php?new=secure.domain.com

The headers returned from the server are as follows:

Read More

Status: HTTP/1.1 302 Moved Temporarily
Date: Tue, 16 Oct 2012 19:55:53 GMT
Server: Apache
Location: http://www.domain.net/wp-signup.php?new=secure.domain.net
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8

Related posts

Leave a Reply

2 comments

  1. Do you have to have secure.domain.com function or can it redirect?

    The tl;dr is that you don’t. The primary domain is the cheese: it stands alone. However…. You can use .htaccess to check ‘If someone is coming from secure.domain.com, send them to domain.com’

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

    That’s about as good as it gets. (Mind you, if your server itself doesn’t redirect http://www.domain.com to domain.com, it needs a kick in the pants anyway…)

  2. In the end I just added the following to .htaccess

    RewriteCond %{HTTP_HOST} ^secure.domain.net$
    RewriteRule (.*) http://www.domain.net/$1 [P,L]
    

    This appears to be working fine, but I’m not sure of what types of unforeseen effects it may have if any.