Domain Mapping - WPMU DEV Premium Style

As you guys might know, we're huge fans of Donncha's work, and I think there was much general rejoycing when he released is domain mapping plugin a bit back.

However, we wanted mooooore, and we also wanted to be able to offer you guys a fully supported and actively developed domain mapping plugin that would be updated with every new WP & BP release.

So we decided to take inspiration from Donncha's work and bring you the WPMU DEV Premium Domain Mapping Plugin:

https://premium.wpmudev.org/project/domain-mapping

Check it out - it works on subdomains and subdirectories (autodetected), handles cross domain cookie synching, integrates fully with the Supporter plugin and even allows for multiple domain mapping to the one blog.

Have a play and let us know what you think... bugs, feature requests, comments and backslapping all welcome in this thread :slight_smile:

  • camaran
    • Flash Drive

    hi, thank you for the plugin.

    I have some problems with charset, if i install the sunrise.php in this plugin and also the feeds rss not work and are empty.

    If i use the sunrise.php in the free domain mapping plugin i not have this error, can you check?

  • Barry
    • DEV MAN’s Mascot

    @camaran - the two sunrise.php files don't really do much different other than the new one skips check for VHOST settings and handle directories, etc.

    In fact, operation wise they should be interchangeable (if you don't want sub-directory mapping abilities).

  • zorag
    • New Recruit

    A quick question, slightly off topic if no one minds.

    Is it possible either now or in future for this plugin to support just normal DNS changes at the users registrar, rather than the CNAME and A record configuration.

  • Barry
    • DEV MAN’s Mascot

    It's not really something the plugin would be able to do. I'm pretty sure everybody reading this has a different set up on their servers than everyone else.

    So adding anything to your DNS servers from within the plugin isn't likely to be possible, outside of specific code written just for you (if it's possible at all).

  • Barry
    • DEV MAN’s Mascot

    @Ovidiu - We've added a compatibility option (or more an un-compatibility option), so out of the box it will now be swappable with the original. For those already running it and want to keep the current table names, open up the new sunrise.php and comment out the define at the top of the page.

  • Enseignement
    • Design Lord, Child of Thor

    Hi all,

    I'm running the same problem :
    domain-mapping is in mu-plugins
    sunrise in /wp-content

    ip is set up in the admin options :

    And i've tried to add a domain mapping for this blog http://blog.enseignons.be/tbi to http://www.infobourg.be

    I've added a A name in the dns manager to point to the same ip, but it doesn't work :

    Champ Type Cible
    .infobourg.be NS ns10.ovh.net
    .infobourg.be NS dns10.ovh.net
    .infobourg.be MX 1 redirect.ovh.net
    .infobourg.be A 91.121.108.225

  • Barry
    • DEV MAN’s Mascot

    Sorry, I'm not understanding what the error is. What are you expecting to see that you aren't seeing?

    From my previous message:
    When you go to tools->domain mapping and add in the domain you want mapped, does it add it to the list? i.e. does the add field disappear?

  • Enseignement
    • Design Lord, Child of Thor

    Hi Cafespain,

    Yes, the add fiel disappear :

    Domain Mapping
    If your domain name includes a sub-domain such as "blog" then you can add a CNAME for that hostname in your DNS pointing at this blog URL.

    If you want to redirect a domain you will need to add a DNS "A" record pointing at the IP address of this server: 91.121.108.225

    Custom Domain Original Blog Address Actions
    http://wwww.infobourg.be http://blog.enseignons.be/tbi/

    I'm expecting that going to http://www.infobourg.be will display the blog : http://blog.enseignons.be/tbi/

    Benjamin

  • qwerty55
    • WPMU DEV Initiate

    After i added a custom subdomain A to the domain mapping and when i see it in the list, i expected that subdomain A is redirected to B, or the way around that subdomain B is directed to subdomain A, when surfing it. Im not sure which way this redirection should go, there is no documentation of that for the domain mapping plugin.

  • Michaela Conley
    • Site Builder, Child of Zeus

    I think it is an interesting plugin however I have a few small gripes...

    No option to redirect the original blog address to the new mapped address. The reasoning behind doing this, is that google penalizes sites with identical content. Running a mapped domain and the original unmapped domain with the same content would be bad for the SEO. Can you force this redirection to happen?

    Also, the remote login/logout doesn't work on my system. After clearing all cookies, logging on at the mapped domain does nothing for the main install and vica-verca.

    If these could be resolved, I would say that this is the BEST domain mapping plugin but for now, I'm still using the original.

  • Aaron
    • CTO

    No option to redirect the original blog address to the new mapped address.

    Also, the remote login/logout doesn't work on my system. After clearing all cookies, logging on at the mapped domain does nothing for the main install and vica-verca.

    Same issues here! I know that the blog address should be getting redirected but is not. Remote login is also not working.

    An additional issue (although this is the same as Donncha's latest version) is that logins do not work using the mapped domain (ie mappeddomain.com/wp-login.php does not work.)

    Any help on these issues? I'm especially confused by the template_redirect call not working.

  • Aaron
    • CTO

    If you want to see the redirect issue you can look at my site.

    I mapped test.missionsplace.com to missionaryspace.com, but you can still visit both addresses. test.missionsplace.com should redirect to missionaryspace.com as I see in the code, but does not.

    I cannot login at missionaryspace.com/wp-login.php, nothing happens. If I login at test.missionsplace.com/wp-login.php I can, but I am not given cookies to be able to access missionaryspace.com/wp-admin/ also as this plugin seems to advertise.

  • Barry
    • DEV MAN’s Mascot

    Can you check your wp-config.php file and see if you have a define in there lablled COOKIE_DOMAIN, DOMAIN_CURRENT_SITE or BLOGID_CURRENT_SITE.

    If you have can you comment them out by putting a // in the front of them and see if that makes any difference.

  • Barry
    • DEV MAN’s Mascot

    If you have the cookie domain set then the cross domain cookies won't work (as wordpress tries to make the cookie on this domain only and not on your mapped one, which browser security won't allow).

    If I remember correctly we had a similar issue with blogs.mu and it's domain mapping, but the bbpress integration still worked when I commented that line out (just checked and that line is still commented out in our config).

    If you are able, can you comment it out and check your bbpress integration still functions correctly.

  • Aaron
    • CTO

    Ok, that solved the remote login problems and my bbPress integration seems to be working still!

    Small gripe here though. If I logout using the main blog or bbpress (ie - missionsplace.com/wp-login.php?action=logout) instead of from the mapped one (ie- test.missionsplace.com/wp-login.php?action=logout or missionaryspace.com/wp-login.php?action=logout) then it doesn't sync the logout with my mapped domain (missionaryspace.com). It's not a huge deal but thought it might be an easy fix.

    Addressing the redirects is very important though. It sounds like you are saying that they are not supposed to happen in this plugin, but I see the same functions and template_redirect action in the source like in Donncha's. I think the front end of a mapped blog needs to be redirected for both avoiding confusion and the search engine double penalty thing. The wp-admin side should be accessible from either address though.

    Thanks for your help!

  • Barry
    • DEV MAN’s Mascot

    It should do (the log out part) can you try clearing out the cookies form your browser and try it again.

    Certainly syncs the logout on my test install, and getting that part to work was one of the reasons we delaying the release.

    I'll look at the redirect. I can't remember off the top of my head whether I enabled it, found problems then disabled it or just couldn't get it working correctly. But then I could never get Donnchas version working properly either.

  • Aaron
    • CTO

    It should do (the log out part) can you try clearing out the cookies form your browser and try it again.

    Tried it many times after clearing cookies. So i'm logged into everything:
    missionsplace.com
    test.missionsplace.com
    missionaryspace.com
    (mapped to test.missionsplace.com)

    If I logout from test.missionsplace.com/wp-login.php or missionaryspace.com/wp-login.php then I properly get logged out from all 3 domains.

    But if I logout via missionsplace.com/wp-login.php then it only logs me out of:
    missionsplace.com
    test.missionsplace.com

    and I remain logged in to:
    missionaryspace.com (mapped to test.missionsplace.com)

  • Aaron
    • CTO

    Another issue I found is with the "My Blogs" panel when you are logged into the backend of a mapped blog (ie - missionaryspace.com/wp-admin/index.php?page=myblogs which is mapped to test.missionsplace.com).

    The links to your other blogs or dashboards get replaced with the mapped domain (missionaryspace.com) for every blog. You can't use it to navigate to your other blogs anymore.

    It seems to be caused by the add_filter( 'pre_option_siteurl', array(&$this, 'domain_mapping_siteurl') ); filter interacting with the get_blog_details() function within get_blogs_of_user().

    You should be able to fix this via the 'blog_details' or "get_blogs_of_user" or 'myblogs_blog_actions' filters. Or if there is a way within your domain_mapping_siteurl() function to detect that it is being called from get_blog_details() and return the default siteurl.

  • Minic
    • New Recruit

    Can someone please shed light on me on what step to do next.

    After mapping, however, when I check on the site (using the new domain name), it only goes to the main WP MU install and not to the subdirectory.

    Obviously there is something that I'm ding wrong. Help please.

  • argh2xxx
    • The Incredible Code Injector

    After installing domain mapping, and now testing it with a tested domain name, and test user account, I saw that it gives error in error log, plus it didn't work at all. For example, I went to admin panel and under tools, and in domain mapping I add my domain name, but it didn't add anything or change anything, and the original blog address still is the same. Of course I had already redirect my domain name to correct server IP address by changing the A Record.

    The error log shows: WordPress database error: WordPress database error: [Table 'dooper_d41.wp_domain_mapping' doesn't exist]\nSELECT blog_id FROM wp_domain_mapping WHERE domain = 'mydomain.com' /* domain mapping */\n, referer: http://blogmyway.org/bv2/itisme/wp-admin/tools.php?page=domainmapping

    How to fix this?

    I'm using multidb and latest of everything.

  • argh2xxx
    • The Incredible Code Injector

    OK, after modify db-config.php and add add_global_table('domain_mapping');

    I went back into test user account >> tools >> domain mapping, try to add the domain name to change the original address, but nothing happen again.

  • Barry
    • DEV MAN’s Mascot

    Ok, can you check that the database table has been created, and if it hasn't can you run the following in your global database:

    CREATE TABLE IF NOT EXISTS wp_domain_mapping (
    id bigint(20) NOT NULL auto_increment,
    blog_id bigint(20) NOT NULL,
    domain varchar(255) NOT NULL,
    active tinyint(4) default '1',
    PRIMARY KEY (id),
    KEY blog_id (blog_id,domain,active)
    );

  • argh2xxx
    • The Incredible Code Injector

    After adding the table to global table, and went back into tools >> domain mapping, I add a domain name, and the list shows the custom domain is now stick, but after try to go to the domain name, I got redirect to the main page!

    My install has domainname/wpmu/userblog/

    I expect the domain mapping points domain such as mydomain name to domainname/wpmu/userblog/, but instead I got point to domainname/

    any idea?

  • argh2xxx
    • The Incredible Code Injector

    OK, I tried to comment out
    //define('DOMAIN_CURRENT_SITE', 'mydomain.org'); // don't include "http://www." at the beginning
    //define('BLOGID_CURRENT_SITE', '1');

    but domain mapping issue has not gone away, and so I tried to comment out
    //define('PATH_CURRENT_SITE', '/subdirectory/');

    but that didn't work either!

    Though I saw this: define('VHOST', 'no');
    should I set it to yes?

  • Aaron
    • CTO

    My install has domainname/wpmu/userblog/

    I expect the domain mapping points domain such as mydomain name to domainname/wpmu/userblog/, but instead I got point to domainname/

    So it does map to the new domain but just doesn't include the /wpmu/userblog/ after? If so I believe that's by design.

  • argh2xxx
    • The Incredible Code Injector

    err, no, because the wpmu root directory is under my main domain name which is runs other applications, so for example, if you visit my main domain name, it's like mydomain.org, and then if you want to create a blog, you have to go to mydomain.org/wordpressmu/, and then after creating a blog, the user's blog would be in mydomain.org/wordpressmu/user/

    if user go to tools>>domain mapping, and enter his/her domain, the empty text box will disappear and under custom domain shows his/her domain.

    After adding mydomain's A record such as @ as host, and server ip xxx.xxx.xxx.xxx as point to domain in domain register's admin panel. After that wait for an hour or two, and then go to mydomain.tld, it doesn't pull up the blog's main page that shows on mydomain.tld/wordpressmu/user/, and it doesn't even pull up the content from mydomain.tld/wordpressmu/, but instead it got point to mydomain.tld. This is not where wpmu root directory got installed!

    Though after you enter mydomain.tld/wordpressmu/user/ you get to see user's blog, but with 404 page not found error.

    Unfortunately, also when you click any link on mydomain.tld/wordpressmu/user/ where 404 page not found (as in sidebar), it redirect you to the link but broken link, such as mydomain.tld/category/fun, but that's not right, it supposed to go to mydomain.tld/wordpressmu/category/fun.

    Anyway, this is not how it supposed to work! I think it's supposed to work when user enter domain.tld, and it will pull up user's blog right away. Please help?

  • Andrew
    • Champion of Loops

    Ah, I think the problem is most likely due to WPMU being installed in a directory instead of root.

    Basically the mapped domain is pointing to your site root. If WPMU was installed there I imagine everything would be working just fine.

    Thanks,
    Andrew

  • argh2xxx
    • The Incredible Code Injector

    I think I got some idea, I'll let you guy know if this will work. I'll use another domain name, modify apache's to have that domain name's root directory to be my main domain name's subdirectory (where wpmu install as root), and then use that domain name's ip as domain mapping ip.

    Hope this will work, LOL.

  • ranarana
    • New Recruit

    Hello all,

    I have wpmu running on Media Temple's Grid-Service (gs) to which I've installed the Domain Mapping plugin. I created a test blog account and point a godaddy parked domain to it using an A record and my (gs)'s IP. However, after 48 hours of letting it propagate, when I visit my custom domain, it just appears blank. Do you think it's my hosting causing this plugin not to function?

  • Brian Tercero
    • WPMU DEV Initiate

    I had some problems with the plugin so I went back to Doncha's version.

    The domain mapping was working fine, until I noticed that all the links to posts, files, etc were showing the subdomain instead of the mapped domain.

    So when someone clicked on any links from the home page, it stopped using the mapped domain and it was showing the subdomain in the address bar.

    Doncha's version changes all the links to the mapped domain name version, and it completely hides the subdomain address. (Except for image files being loaded, you can see the subdomain in the staus bar down below.)

  • nightlyfe
    • Design Lord, Child of Thor

    @briantercero

    I also noticed that the domain isnt being captured by default. I need to manually edit the blog settings in admin to have blogs listed in the directory (in buddypress) show up as domains. setting: Siteurl. (Also seems to help with keeping images in their right place.)

    Note: they must log in under their own domain (domain.com/wp-login) to have the images show up as 'local' in the hard coded url). This seems to be the way most people work anyway..

    Works for a few blogs, but not on an automated basis.

    @James & @Andrew, any chance you guys can set up an issue tracking system? For example, http://drupal.org/project/project_issue works great for being able to see which issues have been addressed, which need further details, and which are resolved (both for you and us). Each module gets its own queue, and each issue its own.. issue (and resolution).

    @James, as I mentioned here, a similar system would be good for doing a 'survey' of needs for future plugins & contests.. maybe even the same system.

    edit: would also be great if you guys fixed the extra quote that is added to URLs when using the link button, eg: '& q u o t ;`

  • Andrew
    • Champion of Loops

    Hiya,

    I'm afraid we're not going to be setting up any sort of bug tracking at the moment. If you've seen the WPMU Trac you know how many pointless tickets get added.

    Also, from what I understand there aren't any actual bugs with the domain mapping plugin. Users just want it to work differently than it does. We'll look into changes but other tasks take priority :slight_smile:

    Thanks,
    Andrew

  • nightlyfe
    • Design Lord, Child of Thor

    @Andrew I'm coming from drupal world where the issues+requests tend to be specific, tracked, and resolved with low duplicates - so it can work. I feel you've got a more technical than average *and paying* audience in this forum.. I would argue we could make it worth your your time. And if you'll put out a poll, you'd find interest. +1 for tracker +1 for getsatisfaction-style feature requests.

    @drmike
    Domains seem to be mapped in links only if the content is created when the user logs in from their domain. It does NOT map if the user logs in at the root domain and then goes to their dashboard from there.

    So yes, +1 for enabling a checkbox that will (1) convert all instances of a siteurl to the mapped domain (primary if several) and (2) 301 redirect to the domain for all uses of the old siteurl.

    I'd prefer that the user visit the mainurl to login and navigate to their dashboard, but still have their media linked the mapped domain. In other words, login at mainurl.com/login and upload images to theirurl.com/files even though they are on mainurl.com -- however this is NOT a requirement, as an alternate, redirect their dashboard to theirurl.com depending on which site they choose.

  • Andrew
    • Champion of Loops

    @Andrew I'm coming from drupal world where the issues+requests tend to be specific, tracked, and resolved with low duplicates - so it can work. I feel you've got a more technical than average *and paying* audience in this forum.. I would argue we could make it worth your your time. And if you'll put out a poll, you'd find interest. +1 for tracker +1 for getsatisfaction-style feature requests.

    I'm afraid it's just not something we're interested in implementing at the moment. Thanks for the feedback though.

    Thanks,
    Andrew

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.