https And Domain Mapping

My main site with the Multi Site install has a ssl cert on it... when I map domains to my multi site you get an error or warning this could be an attacker on your network trying to get you to reach a fake site..

I need to keep this ssl on this site becaue I want to use a check out directly on my site for products and other reasons that the subsites need the security also..

How can you do this to where members can still map there own domain to my multi site that has the ssl cert without all the warnings?

  • scott74

    No I do not have a multi domain cert... But I managed to add a second domain as a second network and then have people map to that one..

    Problem is now is that I am using the define('FORCE_SSL_ADMIN', true);
    in the config file which is forcing https to both of my networks..

    I tried this
    $host = parse_url($domain, PHP_URL_HOST);
    if($host == '') {
    define('FORCE_SSL_ADMIN', true);

    which forced only to the one network but then did not allow me to login with my credentials...

    I am also using

    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule (.*){HTTP_HOST}%{REQUEST_URI} [R,L]

    which i had to remove so i could map domains to the second network that does not have the ssl..

    So I am now looking for a way to force ssl of the first network only via .htacces (or wp config if possible)

    And a way to force ssl login and admin area for the first network also...

    Should be a way to modify the two codes above but not sure how to do it :slight_smile:

    Thanks Scott

  • Mason


    Do you actually have 2 network installs?

    If you want your main site to have SSL and provide for SSL logins to admin even with domain mapping, I'd think the FORCE_SSL_ADMIN combined with setting the administrative mapping setting for domain mapping to the original domain.

    In the first post you mentioned it was just one site on the network that needed SSL, but if you're running 2 networks, the above doesn't help. Let us know. Thanks!

  • scott74

    Hey bud... yes I have two networks... One with a ssl cert attached to the domain and the other domain does not have a ssl cert..

    I have realized that mapping to a domain that is secure does not work... Since the domain with the ssl is just for hosting fan pages on facebook, I really do not need to map domains to that one as the urls are for just pasting in a facebook app which nobody sees..

    So I need to force https for all newly created blogs on the domain that will be hosting fan pages without it affecting the second domain that will be for people to create blogs..

    I have figured out how to do this for the login and admin area by using this in the wp config file

    if ( $_SERVER["HTTP_HOST"] == "" ) {
    define('FORCE_SSL_ADMIN', true);

    by wrapping that like above, it does not affect my second netowrk... If You just use
    define('FORCE_SSL_ADMIN', true); if would affect every network you have.

    but now am looking for a way to force https on all pages and sites create in that first domain without it affecting the second network because if if it does force the second network which does not have a ssl cert, it will screw up domain mapping/ and the second network when trying to access it on the web..

    There is this .htaccess hack to force pages and new sites created to use https but I don't know of a code like I used above for the login and admin area to isolate this to the first domain.

    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    Need some kind of code around that to only force it to the first netowrk.. :slight_smile: all this make sense?

  • Mason


    This is a bit of a shot in the dark, but you may be able to add a second conditional as follows:

    RewriteCond %{HTTP_HOST} ^$
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    No clue if that'll actually work... if not you may try just reversing the order of the two conditional statements.

    Alternatively, you may try setting up two separate vritualhosts in Apache and assigning your SSL to one of them there, but we're then diving into deeper waters than we're able to swim on this forum.

    Let us know if that works for ya though.

  • scott74

    Hmmm.. thanks Mason.... I went ahead and created an addon domain and installed multi site again on the second domain because i could not figure it out..

    I guess the only downside to doing it this way is not sharing the plugins between the 2 networks and updating everything from one spot..?

    Possibly one login for members If I created memberships on both sites also ??

    Not sure how that would work?

    I may repoint the A record and try again... Do you know of any benefits to keeping both domains in the same multi site.. would that work as described above or do you think i will run into more problems doing it that way?

    Thanks for your help.. I am curious to see if that will work..

  • Mason


    Apologies for the delay on this one. I'm gonna ask some other guys to provide feedback here. I just can't seem to wrap my mind around how you have things structured on this one.

    You could perhaps point the secondary install to the wp-content of the first install? Then plugins/themes would be in sync. Users would be a different story. I'm not aware of a tool that would do this. Hopefully, some of the other guys will have some ideas though.


  • scott74

    I got away from the two networks... i am using this define('FORCE_SSL_ADMIN', true); for the admin area of all sites but need a way for all the new sites that get created to have the blog url and site url get prefixed with https..

    You have to manually go in and do it now... This way , pictures that get uploaded get prefixed with https also instead of http..

    Does anyone know how to accomplish this? Instead of having to go into the superadmin dash everytime someone creates a site and having to go to that site/settings and changing the url's manually..

    Update... i thought I may have got it with this but it just changes all blogs to use the main blog url for home and site but it does put the https in there... just need to have the /site of the new blog also...

  • Philip John


    As we haven't heard back from you we're going to assume the problem was sorted out and mark this thread as resolved.

    If it wasn't resolved, or you have any more questions related to this thread please feel free to post them below and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, thanks for using the forums, and, as always, for being a member of WPMU DEV, it's a pleasure to help you out and we look forward to being of assistance in the future.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.