The MU forums have moved to WordPress.org

add (point) domain to one of WPMU's blog (11 posts)

  1. Radja
    Member
    Posted 15 years ago #

    Hello,
    in fact it works for me, BUT I am unable to log in with user that owns blog that is now running on its own domain. Cookie problem? I dont know..

    I want to have this. I have one blog on adress: http://test.blog.com and I want this blog to "run" on adress: http://www.testblog.com

    1./ http://www.testblog.com is pointing to the directory where WPMU 2.6.1 is installed.

    2./ in SiteAdmin blog http://test.blog.com is edited so that: "Domain", "Siteurl" and "Home" is set to "www.testblog.com"

    3./ when I visit http://www.testblog.com it shows content of test.blog.com with no problem, BUT i cannot login as user that owns http://test.blog.com blog.
    When I try to login on http://blog.com it redirects me to http://www.testblog.com, but even if I enter correct login informations, i am unable to login.

    i tried also plugin wordpress-mu-domain-mapping.0.3, but as I see it does something else than I need

    thanks for any suggestion, help

  2. andrea_r
    Moderator
    Posted 15 years ago #

    Donncha's domain mapping plugin does exactly what you need, but since you can't login in the backend of the sublog, that why yuo can't figure it out. :)

    Change it back to test.blog.com.
    Make sure you can login.
    Install that domain mapping plugin.
    Go to the backend of that blog to the Domain mapping tab and place the right URL there.
    Go back to site admin and do step 2 again. Do NOT put in the www part.

    It will work then.

  3. Radja
    Member
    Posted 15 years ago #

    thank you, I did it in wrong order, now it works like a charm :)

  4. peterwilsoncc
    Member
    Posted 15 years ago #

    I've noticed the domain mapping 0.3 plugin makes heaps of database calls.

    In my case, enabling the plugin results in an extra 27ish calls.

    My view is that's way too many for a single plugin; I'll take a closer look at it when I get the chance to see if I can find a way of reducing the number of db calls.

  5. tdjcbe
    Member
    Posted 15 years ago #

    Do you have any sort of caching in place? That may do some good.

  6. andrea_r
    Moderator
    Posted 15 years ago #

    Just wondering how you figured out it makes that many calls, as I've been using it rather heavily and haven't noticed that many.

  7. peterwilsoncc
    Member
    Posted 15 years ago #

    @tdjcbe
    That occured to me this-morning, I'll check it out today and report back.

    @andrea_r
    On a single post page, get_num_queries(); reports 17 queries with the plugin disabled, with the plugin enabled it reports 40.

    Actually only 23 additional calls, my maths isn't great at 2am.

    Running 2.6.3

  8. peterwilsoncc
    Member
    Posted 15 years ago #

    I’ve worked out the solution below by using a global variable in domain_mapping_siteurl; in my case it results in 1 db call on the front end.

    Although it works, I think it very inelegant and would appreciate any suggestions as I’m new to the WP/WPMU codebase.

    function domain_mapping_siteurl( $setting ) {
       global $wpdb, $dm_cache; //$dm_cache added
    
       if (isset($dm_cache['domain_mapping_siteurl']) === false) { //new line
          if( is_admin() ) { // { added
             $dm_cache['domain_mapping_siteurl'] = $setting; //new line
             return $setting;
          }
    
          $s = $wpdb->suppress_errors();
          $domain = $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE blog_id = '{$wpdb->blogid}'" );
          $wpdb->suppress_errors( $s );
          $protocol = ( 'on' == strtolower($_SERVER['HTTPS']) ) ? 'https://' : 'http://';
          if( $domain ) { // { added
             $dm_cache['domain_mapping_siteurl'] = $protocol . $domain; //new line
             return $protocol . $domain;
          }
    
          $dm_cache['domain_mapping_siteurl'] = $setting; //new line
          return $setting;
       } //new line
       else { //new line
          return $dm_cache['domain_mapping_siteurl']; //new line
       }//new line
    
    }

    @tdjcbe I’ll still try caching, but I wanted to try coding something myself in the hope of learning the code base.

  9. Bike
    Member
    Posted 15 years ago #

    Andrea (or anybody else who got this up and running), can you give me some more insight?

    - I have a sublog test.domain.com
    - I have a domain test.com I want to map.
    - I installed the plugin as instructed.
    - I mapped test.com on the manage -> Domain Mapping page of test.domain.com
    - I changed the domains as in step 2 above

    But then it redirects to my servers root (blue apache page).

    Though WPMU is in the root (public_html), its IP address 123.456.78.90 resolves to the apache root only (as there are more accounts on that IP). AFAIK, I cannot add 123.456.78.90/~account/ to any A records? I tried to bypass it with using parked domains, but also did not work.

    It does not seem to make any difference is I add 123.456.78.90/~account/ in the Site Admin Configuration part of the plugin

    What am I missing here?

    Cheers,
    Bike

  10. andrea_r
    Moderator
    Posted 15 years ago #

    You have to park testdomain.com on top of your main domain. :) So that when the server gets the request, it know to send it to the directory where your MU install is.

  11. Bike
    Member
    Posted 15 years ago #

    Thanks Andrea, somehow it got parked on top of the IP, not the domain. Got that fixed and the mapping basically seems to work. Well kinda. Following issues remain after quick test:

    - Previously uploaded files are not found, for example header image (not the standard one, not the replacement). New header image gets uploaded and shown fine.
    - All posts gave a 404 error. Only when changing the permalinks to %postname% it worked (did not change all variations, but the default date/postname 404'd)
    - If I enter the original non-mapped URL (test.domain.com or test/domain.com/posttitle), they do not revert to test.com or test.com/posttitle, but to domain.com (main homepage) & domain.com/posttitle (404 on main blog).

    Is this normal behaviour?
    Cheers,

    Bike

About this Topic