Overriding Domain Mapping only on SSL/secure pages?

Hello. I am using domain mapping plugin with the e-commerce plugin. I need some blogs to have both mapped domains and secure connections to certain pages (e.g. checkout page). Have subdomain setup, current version of domain mapping plugin & WPMU.

To get around the issue of dedicated IPs for the SSL connections, I set up a wildcard certificate for wpmu.com / *.wpmu.com and am fine with having the secure pages *not* mapped, as long as the rest of the site is mapped. The pages need to be un-mapped to keep from throwing a big, ugly certificate mismatch error.

I’m not sure how to override the domain mapping only for the secure connections. Would an .htaccess directive work (and if so, could anybody help me with it)?

Thank you.

  • Goddess
    • Flash Drive

    ok, it appears the .htaccess won’t work; looks like the mapping happens first.

    it looks like if i can hack this line of the the plugin to check for a string in the url of “checkout” (and keep the setting forced to login at the subdomain in admin) that i can work around this. not elegant, but i need the functionality more than the pretty code.

    if(is_admin() || strpos(addslashes($_SERVER["SCRIPT_NAME"]),'/wp-login.php') !== false) {

  • Goddess
    • Flash Drive

    P.S. Want to make sure I didn’t give the impression I’ve resolved this, because I haven’t.

    It makes sense it has to be resolvable since the domain mapping is done in the code and the redirect can be forced to the subdomain for admin signons.

    I’m just not a coder…

  • Goddess
    • Flash Drive

    I was under the impression the domain mapping was a supported plugin and these forums were the place to request support. Am I missing something? Do I need to do something else?

    My need to resolve this issue is not going anywhere. Am I wasting time expecting some kind of response?

  • Andrew
    • Champion of Loops


    Apologies for the delay. We’ve been a bit tied up the last few days.

    I’m afraid though that your “issue” really is more of a “feature request” as you’d basically just prefer that the domain mapping plugin work differently than it does :wink:

    We’ll look into this and see what we can come up with over the next few days.



  • Goddess
    • Flash Drive

    Andrew- Thank you for the reply. I appreciate my request being acknowledged. Point also taken that the plugin is functioning and therefore this is considered a feature request, even though I think of it in terms of a problem that it’s my responsibility to resolve, because for me, it is.

    I appreciate whatever help you’re willing to give, and will check back.

  • Barry
    • DEV MAN’s Mascot

    @goddess, can you help clarify some things for me?

    1. You want the majority of the pages to work on a mapped domain, but some – relating to the check out process, to be kept at the domain you have the SSL certificate registered for?

    2. You can identify the pages you want to be directed to the SSL (via the address / slug)?

    3. Those pages are common across all blogs on your site. For example, you can be certain that you want the /checkout page to not be domain mapped across ALL blogs on your installation?

    If so, it may be easiest to add the check in the sunrise.php file, rather than the plugin itself. If you can answer yes to the above three questions, then it may be a relatively simple bit of code otherwise we may be getting in to more tricky checks.



  • Goddess
    • Flash Drive

    Hello Barry. Thanks for your response.

    Ideally, the check would be on the SSL connection itself and not the URL. None of the mapped domains will have their own IP or SSL cert directly, so that would provide the most flexibility.

    I was looking at URL because I thought I may be able to hack it easier. My PHP skillset is very limited. I can control the url/slug and standardize as necessary, but obviously that’s less robust solution.

    The URL check would be of less use to others, while the ability to turn off domain mapping for SSL connections probably would help others who want to do something similar, to provide both domain mapping and a cart with SSL via wildcard on WPMU.

    Bottom line for me, however, is whatever will do what I need, I will be happy with.

  • Goddess
    • Flash Drive

    To more directly answer your questions:

    1. Yes, need the majority of pages to default to mapped domain as normal.

    2. The specific pages to ignore domain mapping can be identified by url/slug if needed

    3. Yes, having certain slugs direct to non-mapped domain across entire installation is acceptable.

  • Goddess
    • Flash Drive

    Just checking in on this. I realize WPMU Dev is not obligated so it’s essentially it’s a favor I’m requesting; I’m just getting to the point I will need to hire a coder soon if you’re not able to help. I have to be able to deliver secure connection to shopping carts.

    Also don’t mean to make it more difficult with my arguments for SSL detection vs. URL detection. I don’t have a good enough understanding to know which is more demanding.

    My preference is getting the assistance here, both because of the additional cost, but especially because I know whatever help I get here is not likely to break with updates down the road. That makes my life easier.


  • Goddess
    • Flash Drive

    Not trying to be a pest, but I’ve been on this a couple of weeks now and it’s becoming more pressing daily for me to get it resolved.

    I’m kind of at a loss, not knowing if it’s a lot more complicated that I thought it would be, if it’s getting lost in the shuffle, etc. I know it’s not cool to be demanding when you’re asking for a favor, but I have to get this figured out one way or another.

    Can I get an idea of what kind of time frame we’re looking at?

  • Barry
    • DEV MAN’s Mascot

    It’s half way there, I have it detecting certain url paths, but for some reason i’m getting a redirect loop occasionally, so as soon as i get my head around that I’ll move this thread to the members only section and upload an update.

  • Goddess
    • Flash Drive

    Thanks so much, Barry. It was one of those things that somehow didn’t even occur to me until I tested it. I try to avoid getting myself in these situations, but once in a while, I miss the mark.

    Your help is very much appreciated.

  • Goddess
    • Flash Drive

    I’m specifically trying to avoid domain mapping for certain pages. My reason is because of a wildcard SSL, but it looks like Barry is approaching it based on string match in the url, so it would be applicable in other venues.

  • monsterdevelopment
    • Design Lord, Child of Thor

    I am in need of the same fix. I did not find this thread until after I posted and I was directed here… sorry about that.


    I think identifying the SSL pages that are not to be mapped via a custom field would be great, not sure if that is possible.

    The idea of being able to add certain slugs that could be loaded in SSL would do it to.

    Either way, I am anxious to see what Barry cooks up! I would love to have this asap.

    Thanks for all the great work guys, the plugins are great!

  • monsterdevelopment
    • Design Lord, Child of Thor

    Yeah, I am getting to that point too…. I thought about splitting the cart and the site like that. Hope they come up with something cool to work with the domain mapping feature, I think this is going to be a more frequently needed thing as more and more people turn on Multisite mode on their WP installs and want to use mapped domain names / Wildcard SSLs.

  • monsterdevelopment
    • Design Lord, Child of Thor

    Thanks Aaron, I would love it if there was a way to do this. It is one of those issues that, if solved, will really enhance the usability of WPMU. I am thinking that this configuration with Wildcard SSL will be very popular for a lot of users.

    How it that workaround coming Barry? Can’t wait to try it out. I really could use it.

    Thanks again!

  • shirtandsimple
    • Design Lord, Child of Thor

    I had not thought about this but am all of a sudden very nervous that my plans to switch my network to WPMU might not be as good of an idea as I thought. We haven’t started yet but I really wanted to be able to use domain mapping. If each one of my sites needs their own shopping cart, what solutions are there for SSL certificate? Wouldn’t this be an important feature for your membership, support, and eCommerce plugins?

  • Theokie
    • WPMU DEV Initiate

    if(is_admin() || strpos(addslashes($_SERVER["SCRIPT_NAME"]),'/wp-login.php') || curPageURL() !== false)

    That function checks the URL for certain keywords and it works but I get a “redirect loop” error… :slight_frown:

  • bevelwise
    • New Recruit

    @usabn Thanks for the code. Just to further describe your code, I’m going to attempt to translate it into English. Please verify what I’m saying if you don’t mind.

    * Since the code is in the wp-config.php file, this is set to website and/or network wide.

    * If the current url is NOT a secure connection – in other works, if the current url is NOT https://

    * Then turn on the domain mapping

    * This can also be stated that if the current url IS https:// then do not apply the domain mapping so it will use the non-mapped url for the page.

    Is this correct?

  • scott74
    • The Crimson Coder

    I added this to the wp config but did not work for me…. Do yo have any other suggestions usabn I am using multi site with subdirectories and mapping to those.

    I actually just want to map a second domain to creat a second network and then map to the second domains subsites but the second network gets the errors because it is mapped to the first with the ssl

  • usabn
    • WPMU DEV Initiate


    Not sure about that one. I’m using subdomains myself.

    One other thing that I’ve noticed is that on the secure pages, all of the links go to subdomain.domain.com . I’d say this would happen on sites using folder structures as well. This could potentially cause duplicate content issues.

    So, I’m trying to figure out how to get around that. Thought I’d throw it out to the community to see what anyone else thought.


  • brightfire
    • Design Lord, Child of Thor


    I’m having the exact same problem. I’ve tried many variations of conditionally loading sunrise and can’t seem to get this to work either.

    Just to be clear:

    Sites created are:

    domain.com is the base site for the network install

    domain.com/subsite is another site installed on the network and has mappeddomain.com mapped to it

    Plugins installed are:

    Domain Mapping is installed

    WordPress HTTPS is installed

    Selected Domain Mapping options are:

    – Remote Login

    – Redirect administration pages to site’s original domain (remote login disabled if this redirect is disabled)

    When viewing mappeddomain.com all non SSL pages are fine. However, if I have the “contact” page for mappeddomain.com (aka domain.com/subsite) set to “Force SSL”, then the request is redirected to the base site of the network install. It should be going from http://mappeddomain.com/contact to https://domain.com/subsite/contact but instead it is resolving to https://domain.com/contact.

    FYI, logging into the admin with ‘FORCE_SSL_ADMIN’ are redirecting as expected – https://domain.com/subsite/wp-admin/

    Any idea why this is handling SSL while in the admin correctly (using the base install domain/subsite structure) but the same format doesn’t work on the front end?

  • Leonardo
    • WPMU DEV Initiate

    I know this has been posted a long time ago. But I wanted to know if anyone has an update that was able to make this work. The conditional sunrise, just causes a redirect loop, instead of actually landing on the sub domain.

    Any updates?

  • Bryan
    • Flash Drive

    Why not in the Domain Mapping SuperAdmin settings implement an option to allow the site to be access both at the subsite and mapped domain, just as the admin sections can be accessed from both the mapped and subsite urls?

    Is that possible?

  • Bryan
    • Flash Drive

    Free For Charity,

    It looks like they have addressed this with the new released. There is now a drop down option (Front end redirect should be) within your sub-site domain mapping area with the following options:

    – disabled and entered domain should be used

    – directed to mapped (primary) domain

    – directed to original domain

  • Gabe
    • The Bug Hunter

    @aaron and @Barry

    You guys mentioned the possibility of defining certain pages in sunrise.php that would always use the original SSL subdomain rather than the mapped domain (i.e. /checkout or /payment) network wide.

    Could you provide examples of this that we can add to our sunrise.php to work with the Domain Mapping plugin? Some of us are using other pay systems like Stripe, Paymill, etc. where we’d like to use a secure page, but need the SSL cert of the original unmapped domain.


  • wp.network
    • The Bug Hunter

    I second Jetmac and third Gabe!

    That would be an awesome feature!

    It would seal the deal for me with MarketPress… Currently, I also use iThemes Exchange. I’ve been fence sitting and this single feature would def help me decide for MarketPress. Just Sayin.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.