Some issues on WordPress MU Domain Mapping plugin

Here are most important issues, that I ran into (and resolved most of them) when installing and using WordPress MU Domain Mapping plugin, which allows to use different top-level domains with WordPress Network (WordPress base installation, without this plugin, only allows subdomains to be used).

There is a very good and detailed blog entry on these matters, available here. The thing is that this guide is two and a half year old. It is now nearly completely out-dated. Plugin has evolved by that time and has been updated many times. That is, why you see some many differences between those screenshots and messages there and real plugin.

For me, instructions at installation tab of plugin itself was enough for me. I was able to setup all the things and get it all working.

General issues

Issues that I run into:

1. Image, you’re referring to is Domain Mapping section, where you add actual domain, you want to map to your blog site. You can access it via Tools > Domain Mapping. But it is available there only for all your network-created sites. That is: only for those blogs that were created after you finished setting up your blog network. This option is not available for Network Admin and not for blog (site) you had installed as first one, before creating a network.

2. Maybe most important. Due to (probably) some bug in this plugin, section Tools > Domain Mapping is not available (visible), if you network activate this plugin — i.e. make it active for all your sites. Deactivate it (click on Network Deactivate in Network Admin > Plugins) and instead go to each of your sites (except: as above) and manually activate this plugin for each of your sites / blogs. Only then this option become available and you’ll be able to access screen, you’re showing on screen-shot.

3. If, after clicking activate (either network-wide or site-alone one), you see a message about fatal error about redeclaration of some functions, then this 99,99% because I have read (and did) whole OUTDATED Otto’s blog and copied a file into mu-plugins directory. This is DEPRECATED, you don’t have to do this anymore. Keep yourself with installation guide on plugin page and forget about all this mu-plugins stuff!

4. I used IP address instead of CNAME in plugin configuration and it seems to be working for me just fine. That is all for plugin. As for your domain (DNS) configuration: you probably should use both CNAME and IP address in domain config to be able to access both and I wrote “problably”, because I haven’t tested this out. It works just fine for me, no matter if I use my domain with or without www., so I haven’t even checked, what do I have configured in my domains. If you don’t need www., then you can forget about all this CNAME stuff.

Domain Mapping for blogs under construction

There is a special issue (scenario), if you use Domain Mapping plugin along with any plugin that prevents uses of your blogs to access frontend without logging in. There are many such plugins (look [here](Using shortcodes or plugins to hide content from not registered users) for more details), which are widely used to secure your blog network’s sites that are still under construction, from unauthorized access to unfinished content. If you have any of such plugins enabled, read on.

After adding a domain to any of your network’s site, you have to go back to Network Admin Dashboard, to “Sites” section, edit each site, that has a top-level domain mapped to it, and change value in “Domain” field (first field on first, “Info” tab). If you don’t do this, and leave default value, which points to a subdomain, you’ll not be able to login to any of your sites. This is because, with default domain setup (subdomain), WordPress takes you through login process in this domain (subdomain) and writes login cookie for it. Next, Domain Mapping plugin is doing a redirection to a mapped domain, for which login cookie is not available (for security reasons, there is no way to set a cross-domain cookies). Since WordPress, after domain redirection, doesn’t have a login cookie set, it redirects you back to login form and the whole story begins again.

This happens only for frontend, secured with proper plugin from access by unregistered users. If you keep default, subdomain address, you will be able to login to dashboard, as it is always reachable through subdomain URL in that case. Only frontend page is reachable via top-level domain. Or, to be more precise, it is also reachable under subdomain, but Domain Mapping does above mentioned redirection right after. But only for frontend, and that is why dashboard works fine, but accessing blog itself fails in this scenario.

If you switch site domain from subdomain to your top-level domain, both dashboard and frontend will be reachable under top-level domain. But in this case, WordPress login process will write a login cookie for your top-level domain, so you’ll have access to both frontend and dashboard.

Leave a Reply