WordPress 3.0 Domain Mapping 0.5.2

I’ve just released WordPress Domain Mapping 0.5.2. This plugin allows you to map any domain on to your WordPress 3.0 or WordPress MU website.

New in this release:

  • WordPress 3.0 support.
  • Added “domains” page for superadmin to add domains to any blog. The user’s domains page can be disabled by the superadmin too.
  • Added support for “www.” prefix in front of domains.
  • Allow dashboard to redirect to mapped or original domain.
  • Better support for SSL
  • Translation file added for localization.

For security reasons remote login is now disabled if the dashboard is redirected to the mapped domain. There is a tiny chance of a man-in-the-middle attack during redirection, but it’s just as likely to happen when you’re logging in and sending your username/password to the login form. Call me paranoid.

I would like to thank Ron and Andrea who were a huge help developing and testing this release. Andrea has written a great post on creating a network in WordPress 3.0 plus instructions on upgrading from WordPress MU. Great stuff!

89 thoughts on “WordPress 3.0 Domain Mapping 0.5.2

  1. Hello!

    Could you make a tutorial teaching how to move a WP 2.9.2 to an existing 3.0 network? If possible, I’d like to create a site in the network, rename .sql tables to match this new site and just import it directly using mysql, without risking WP to filter and break anything during export and import.

    Is that possible?

  2. Great! Thanks. Version 0.5.1 has been working in WP 3.0 very well, but I’m excited for the improvements.

  3. Hey Donncha, thanks for supporting this plugin and helping those of us who were previously running multi-domain WPMU setups make the jump into 3.0.

    I only ran into one issue with my setup, which was that I run with the wp-content folder in a non-standard location, by defining WP_CONTENT_DIR in the config file. The sunrise check in domain_mapping.php was failing because of this (since it’s checking ABSPATH/wp-content), so I updated this one line to check for and use WP_CONTENT_DIR and it seems to be working fine.

    Are there any other potential issues with that approach that might come back to bite me that you can think of?

    Thanks again.

  4. May I ask, as a very humble WP addict, whether this plugin provides a solution to the fact that apparently my server provider (BlueHost) does not support the option of multisites being configured as subdomains and so I can/have only set up my trial sites with the option sub-directories?
    Thanks for the (simple hands-on explanation) of your plugin’s possibilities on this issue.
    Thanks very much

    1. I got WP3 working with subdomains, after moving my existing web site to an add-on domain and installing WP in public_html. Techs at LunarPages worked with me to get it going, turned out what they thought wouldn’t work, worked easily, including setting up Wildcard DNS through CPanel. Maybe your server provider actually can do it? I documented what to do, on a “normal Apache” host, WordPress 3.0 Multi-Site Installation with Existing Web Sites. (Used the Domain Mapping 0.5.2 plugin, of course, thank you Donncha!)

  5. Hi Donncha, I’ve been waiting for this feature to surface. I’m glad it’s finally available as a plugin in WordPress 3.0. I’ve been wanting to consolidate all my blogs into one. Thanks a billion!

  6. Hey Donncha could you answer me a question?

    If I don’t set alternative domains to redirect to primary one, the same site will be served for multiple domains roght? Will get_option(“siteurl”) and WP_CONTENT_URL use current domain or will then return the primary domain?

  7. I already finished chinese translation with poedit. And I found that some place can not translated, it lost some gettext domain.

    At last how can I send the languages pack to you?

  8. I want to point out, that if you have a 3.0 Multisite, and you use the automated installer in wordpress, that you have to MOVE domain_mapping.php to the mu-plugins folder, and NOT COPY it. Having a copy in both locations will break your site.

  9. Hi Donncha,
    thanks for the great work first. i got a problem here.
    i studied your instruction and a couple of tutorials from others. i am pretty sure that i did right of the installation and configuration, but when i visit a new domain i got the registration page instead of the blog. for DNS setting, i choose Aname and i only point one Aname to the ip address. so could you please give me some tip to fix? thanks again for your time.

    1. It’s not installed or maybe configured correctly unfortunately Jerry. The plugin should intercept the blog lookup and stop the registration page appearing.

      1. Haven’t work yet. So here I am putting details of everything:
        –Virtual host with an IP dedicated; backend is directadmin;
        –A couple websites in the virtual host and domain.com was set default site, where wordpress 3.0 installed;
        –Subdomain was chosen, and wildcard was set in the dns of domain.com;
        –Plugin was installed followed below instructions:
        1. Copy sunrise.php into wp-content/. No sunrise.php there.
        2. In WordPress 3.0, create wp-content/mu-plugins folder.
        3. Copy domain_mapping.php into wp-content/mu-plugins/.
        4. Paste define( ‘SUNRISE’, ‘on’ ); into wp-config.php.
        5. As a “super admin”, visit Super Admin->Domain Mapping to create the domain mapping database table and set the server IP address or a domain to point CNAME records at.
        6. Definition of COOKIE_DOMAIN in your wp-config.php not found.
        –Configuration doesn’t matter I think, I have tried many options of different configurations;
        –test.domain.com was created successfully;
        –test.com dns was set one Aname to the dedicated IP; no other settings for test.com dns;
        –at backend of wordpress, test.com was set primary domain of test.domain.com;
        –visit test.com I got http://domain.com/wp-signup.php?new=test.com
        Which likes the same problem of below link describes, I am not sure whether it is same problem or not;
        as its solution I checked wp-config.php, which has been modified successfully, but it still doesn’t work;
        Above is what I have done, hope info is enough;
        Meanwhile in the official instruction mentioned cpanel setting, which as my understanding we should park test.com to domain.com in cpanel, since I am using directadmin, I use domain pointer to point test.com to domain, still doesn’t work;
        Thanks for your time and if any info need I can add later.

          1. Donncha, finally it worked with this comment. highly suggest put this tip into instruction. thanks again for your great plugin and time.

  10. Hi,
    sorry for that newbie-question, but aunt Google didn`t helped me out. I just installed the latest version of your plugin. Now there is described to edit the config.php file to define Sunset. Yet, I haven`t found any line relate to “Sunset” and any try to past “´SUNSET, ON´ failed as well.
    So where exactly do I have to past what kind of snippet into the config-file? Thanks for answering!

    1. Todd, Gabriel – it’s all in the readme.txt

      You add the line define( 'SUNRISE', 'on' ); to your wp-config.php, somewhere before the last require_once().

  11. Donncha – Thanks for answering!

    I past it just upon “That`s all,…” Now it works.

    Todd – Moreover I copied the mentioned files to the described folders and renamed them as the originals.

    Donncha – we just have a great sunset in Europe. 😉

  12. Thanks, Donncha and Gabriel. It’s working now — thanks for your great work, Donncha. Consider me proof that the smart ones stayed behind in Ireland while they shipped my family to Amerikay…

  13. Hi, thanks for the tip. I’ve manage to get everything up and running with 2 subdomains and 1 main domain. The subdomain all mapping well, but I’m not sure how to get the main domain to show the prefix www as everytime i put in http://www.maindomain.com it goes to http://maindomain.com. Any idea how to do this.

    1. I have the same question. How to maintain www prefix for the main domain. www for the subdomains is working fine.

      Donncha: please advice. Is it possible?

        1. Hi

          When multisite is enabled there is no setting for blogurl or homeurl in settings->general. If you go to superadmin->sites->settings there is no way to change this settings either.
          Any other tips Donncha, or anyone else?

          I have a client that want www, i personally don’t want it.

  14. Hi! I just localized this plugin to norwegian, and I discovered a few localization bugs..
    1: the load_plugin_textdomain (line 29) needs to be changed if the plugin is to be placed in /mu-plugins
    2: some strings were not localized
    3: some strings were not in the pot-file.

    I have made suggestions for corrections and uploaded the php file here:

    (with this mod, the language files have to be in the folder wp-content/plugins/wordpress-mu-domain-mapping/languages)

    and the norwegian language files here:

    see the project page here:

  15. Hi,

    I installed this plugin but on WP 3 (multi blog enabled) but I get the following message :

    “Fatal error: Cannot redeclare dm_text_domain() (previously declared in /home/content/r/u/c/*/html/wp-content/mu-plugins/domain_mapping.php:29) in /home/content/r/u/c/*/html/wp-content/plugins/wordpress-mu-domain-mapping/domain_mapping.php on line 30”

    I am not able to figure out that what could be wrong.



      1. Hi,

        Thanks for the reply. I just removed the file from the mu-plugins directory and the plugin is working absolutely fine. I was even able to map the domain in the other blog that I created and its loading perfectly fine.

        Just one more question. Is it not possible to access the blog with both ..com & .com?

        I tried to do that but the blog is redirected to the primary address that we set. Is this the default behaviour?



      2. I just posted to the WP Forums about this. According to your documentation for the plugin, we’re supposed to COPY it from one location to the other, which would mean 2 copies. Might want to change the installation instructions.

  16. Donncha, thanks for your patience with me so far. I’m trying to find a list of system requirements for using 3.0 in a multiuser version, but so far it’s eluding me. For example, do I need a dedicated ip address, a dedicated server, etc. Admin on 3.0 is so easy, I want to move all my clients to a 3.0 install with BuddyPress and a forum for support — I’ll have to use your plugin because of course they’ll want to map their domain to their site and it needs to appear seamless to the outside world…

    1. Requirements are much the same, but the more memory and cpu you have the better. So go with what your budget can afford.

        1. Todd – Your server will have an IP but it has to respond to all the hostnames you map to it so a simple shared hosting account might not suit. I use a VPS at Linode but then I take care of admin tasks too. Apache on your server has to answer for any unknown hostnames that are fired at it. If those hostnames are checked by some outside agent and handled that way it won’t work.

          1. Yeah. Struggled with this for a couple of hours and discovered that GoDaddy does not support subdomains for WordPress multisites: http://help.godaddy.com/article/6143. Amazingly, Siteground says they can do it for $50 per year. Any recommendations on a good hosting provider that speaks WordPress? I’m going to put my client base on the server so it has to be reliable…

  17. Hi, I get this message in browser:

    “The constant “COOKIE_DOMAIN” is defined (probably in wp-config.php). Please remove or comment out that define() line.”

    but the constant “COOKIE_DOMAIN” is not defined in wp-config.php file. Any idea how to fix this issue? Thanks.

    1. I have resolved the issue commenting this line into mu-plugins/sunrise.php:

      //die( ‘The constant “COOKIE_DOMAIN” is defined (probably in wp-config.php). Please remove or comment out that define() line.’ );

      This check is not good because if the constant “COOKIE_DOMAIN” is not defined, will be defined into wp-settings.php

      (I am using WordPress MU 2.9.2)

      1. AWESOME 😀

        This comment ended a battle of over 2-3 hours with installing and running WPMU. My sites now work.

        Multumim 🙂

  18. Hey guys,

    If you’re using a shared server, you can use this plugin in one of 2 ways.

    The cheaper way, is to talk to your hosts, and get a dedicated IP address for the domain which wordpress is installed, this it usually a couple of dollars a month.

    Or you can purchase a reseller account which would allow you to edit the DNS to the required needs.

    I’d use CNAME if you use the reseller and A record for the dedicated IP.

  19. Donncha, sorry to bother you with this, but I’m unclear as to what this means: “Super admins can now choose to either allow users to setup DNS ANAME records by supplying an IP (or list of IP addresses) or set a CNAME but not both (entering a CNAME for the end user voids the use of IP’s)”. Can you help?

    1. Hi,

      Basically, you cannot use both the records at the same time. Either you would add the A record or the CNAME record, but not both.

      So if your customers wants to map their domain to the sub-domain, they will either add the A record which requires the use of the IP address or the CNAME record which is normally the host record of your server.

      Also, if your customers add a CNAME record, then they will not be able to use the email services. This is the major drawback of using the CNAME record. So its always advisable to add a A record.

      Hope I answered well.



  20. Hi, first of all I love the plugin, thanks so much for creating it.

    I’m having a strange issue where the login page redirects to a subdomain on the main domain (so tl-dr.net becomes tl-dr.gekidasa.net), and then when I press the submit button it reloads the login page but never actually logs me in. I’m getting around it by using the sidebar login plugin. Any help would be appreciated!

  21. Hi,

    One thing that why we can’t add domain mapping for the main blog. For e.g. I have all the variants of the domain and have parked them on top of the main domain. Earlier, these domains used to open the main blog but since I installed WPMU, when I load any of these parked domains, I get the message “Registration is disabled”.

    I think there should be a provision to add domain mapping for the main blog.



    1. Hi Donncha,
      Thanks a million for the upgrade to version 0.5.2, which is compatible with WP3, awesome! yet I have this seemingly little glitch, I want two domain names to point to the main blog (e.g. main1.com and main2.com), and the rest mapped according to their respective sites. However, the second domain (main2.com) keeps bringing up the disabled registration page. How can I force main2.com to show the same page main1.com is showing?

      Thanks a lot man.

      1. This is what I am also looking for and wondering if this is possible or not.

        For e.g. I have most of the variants of the ruchie.com & ruchi.com domain. Earlier, when I was not using WPMU & later WP multisite, the additional domains used to load the ruchie.com site.

        But now I too get the same message like you are getting.

        1. I got a temporary solution to my problem by making main2.com and addon domain instead of a parked domain and doing a .htaccess redirect to main1.com (I used addon instead of parked because while creating a redirect, the existing WP3 .htaccess of the main website is edited and sometimes corrupted, so the the new redirected .htaccess resides on a different folder from the main website). However, I am not very good at editing .htaccess, therefore I am not able to make a complete redirect of e.g. main2.com/members/chgpass.php to a corresponding main1.com/members/chgpass.php

          1. I too did the same except I set the redirection on the parked domains.

            I really wish if there were some provision in the plugin or may be right inside the WP3 to make this possible on the fly.

          2. Just found a permanent work around to this. Edit your wp-config.php file and add the following line:

            define ( ‘NOBLOGREDIRECT’, ‘http://…’ );

            Replace … with the path where you want to redirect the domain.

            This is also particularly useful if you have disabled site registration / if site does not exists, the visitor will be redirected to the said path.

            Hope this helps.

          3. Awesome, even though it does not solve all my problems, it solved a whole lot, and the additional 404 issue, created by this solution, I was able to find a way of getting around (http://frumph.net/wordpress/wordpress-3-0-multisite-subdomain-installation-noblogredirect-behavior-fix/)
            My main problem is redirecting something like site1.com/cp/ to site2.com/cp/ and I have a feeling it will require a lot of url rewrite in .htaccess, which I am not familiar with, but thank you very much.

          4. I feel really dumb, the solution was way easier than I imagined. A single line in a .htaccess file in site1.com:

            Redirect 301 / http://site2.com/

            redirects everything, files and folders accordingly.
            And thanks for sharing your find.

  22. I’m having difficulty with custom permalinks. When i have the default permalinks everything is fine.

    Is there something I could have messed up that would cause this issue.

    (upgraded from wordpress mu to 3.0)

  23. This plugin really rocks!

    Everything seems to work fine, but I’ve just ran into one problem.On all domains mapped to the original domain the links point to subdomain.example.com instead of subdomain.com. Is there a way to fix this? Content must be available on only subdomain.com, links must point to subdomain.com only.

    Thanks for taking the time!

  24. Read through comments, but still don’t know what to remove as the uncomment (‘SUNRISE’, ‘ON’). When the plugin was installed it added this line to my wp,config.php page

    // uncomment this to enable WP_CONTENT_DIR/sunrise.php support
    //define( ‘SUNRISE’, ‘on’ );

    thank you.

  25. I’m glad a new version is out, unfortunately I haven’t the time to upgrade my wp 2.92/0.5.1 combo.

    I’m fighting against the “unknown login key” error that I think is related to the remote login. Donncha, do you know if I can “fix” it by disabling the remote login in some way?

    Thanks for theplugin.

  26. We’ve made some changes to domain_mapping.php to include support for the redirect_to querystring option as all query string variables are stripped out when a javascript redirection occurs.

    This can be replicated on a mapped domain which requires logins before commenting and has been confirmed on WPMU 2.9.2 – I haven’t tried 3.0 yet.

    It’s about 20 lines but if you would like to consider it, please contact me via email – I’d be mostly appreciated. Thanks.

  27. Hiya! Thanks for this awesome plugin…

    Are you saying that there will not be bale to be users for the individual domains? There will only be users that are admin and they can get to ALL domains?

    Is that right?


  28. I’m not able to login in all the domains (exception for the main domain that works fine). When I go to the login page, I insert the data, submit, WP refreshes the page without returning any error (simply it does not connect al all:() Any idea about why this is happening and how to fix it?

    PS: My hoster uses CPanel and I followed the instructions

    1. Hi,

      The same problem happened with me when I moved the installation from root to a sub-domain. I edited all the references in the config file and DB and the same login problem. I was only able to login to the main site but not the other sites.

      I am not sure but I think that there could be 2 possibilities:

      1. You installed WP3 multisite in some sub-domain or folder.
      2. You moved the installation to some different folder to sub-domain.

      I did lot of playing around with the settings bit nothing worked out. Finally, I moved the installation back to the root and now its working fine.

      If you do find the solution, please do let me know.



      1. I didn’t do any of the two :(. I checked and I have the installation in the www dir and the installation where the installer left it

        1. Hi,

          Are you using cPanel? If yes, then the files must go in the public_html directory rather than the www directory.

          If non of the above, then please send me a mail at support.ruchie at gmail.com with the complete details and I will try my best to see if your stuff is up and running.



  29. Great plugin, thanks Donncha.

    Our current WP install is in http://www.site1.com/articles
    Can this be made to work in multisite with http://www.site2.com, http://www.site3.com, etc?

    If not, is this something that could be added to a future version? We would be open to sponsoring part of that work if this is not a huge endeavor.
    Or is there some technical reason why having WP installed in a subdirectory will never work with multisite multidomain? Thanks.

    1. Guillaume – it’s a technical thing. Apache (or whatever webserver) virtual hosts have to point at the directory where the original site is installed.

      You’d need to have mod_rewrite rules in / to handle site2.com, site3.com etc that would pass requests to WordPress in /articles/. Things would get very complicated!

  30. Great stuff Donncha. I will add a link to this page on my last article. When I upgraded from wpmu 2.9.2 to Multisite 3.0.1 I received that:

    “You don’t have permission to view this site. Please contact the system administrator.”

    So I need to upgrade to this version of the plugin to fix that issue.


  31. Hi, I was wondering if somebody could help me I have installed everything and keep getting this message when I go in to Domain mapping menu-
    Please uncomment the line define( ‘SUNRISE’, ‘on’ ); or add it to your /home/dirk/public_html/wp-config.php
    I have checked it several times (5 to be exact) and there are no slashes to remove and as far as I can see it is all ok, please help I have spent over an hour try to sort this out?

  32. hi Donncha, first of all thank you for the plugin. I’ve installed it and all is working fine except I can’t seem to find a way to retain the www. prefix in my domains.

    I see in your release notes that 0.5.2 has “Added support for “www.” prefix in front of domains.” Can you please explain how to configure this?

  33. Hi,

    Maybe I’m being dumb, as I’m new to WP Multi-site and the domain mapping plugin, but I can’t get it past this hurdle.

    I have the main site and a sub-site (as a sub directory) set up, and a second domain mapped to the sub-site – all OK so far:

    http://www.othersite.com -> http://www.mainsite.com/subsite

    If I go to http://www.othersite.com, it displays the subsite home page fine. But all the links on that page refer to, for example, http://www.mainsite.com/subsite/?page_id=2 rather than http://www.othersite.com/?page_id=2, and so any click effectively takes you back to the main site subfolder.

    I know that sunrise.php is being called, and I checked the contents of $_SERVER[ ‘HTTP_HOST’ ] – it does contain http://www.othersite.com when viewing the mapped domain. I’ve also tried fiddling with the permalinks, but that didn’t seem to help.

    This is my .htaccess file – its all been generated by WP, not by me.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Any clues as to how to get the links on the subsite pages to refer to the mapped domain?



  34. I have a question. I have been using your plugin. (thanks). My sites on my network are showing up as ie: bob.mysite.com in the backoffice area and being mapped correctly in the browser.

    So, when someone uploads a pic to their backoffice, the picture resides at ie: bob.mysite.com/files/2010/09/bank-owned-homes.jpg.

    Is there a way to get rid of the subdomain everywhere in the backoffice so that the urls in the post and page windows and the images point to the mapped domain? ie Bob.com/files/2010/09/bank-owned-homes.jpg instead of the subdomain?

    The reason I ask is because I have moved some blogs over and the images seem to get broken on the move for some reason. Plus having the subdomain in the backoffice might confuse some users. Thanks

  35. will this plugin forward https to the original (unmapped) domain? I am building on my local server and can’t figure out how to test it.


  36. Greeting, Donncha! Hope all’s well in Ireland today. Here? Not so much. I just updated my Multisite install to 3.1 and now I’m getting this error: “Please edit your /home/lvation/public_html/wp-config.php and move the line define( ‘SUNRISE’, ‘on’ ); above the last require_once() in that file or make sure you updated sunrise.php.” I’ve checked both the wp-config file and the sunrise file and both seem to be in order. What am I missing?

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.