This plugin allows you to have multiple domains in a single Wordpress installation and enables custom redirects for each domain.
Important: This plugin has a new maintainer. So the plugin will now be active developed again, and it’s now part of goINPUT.
Multiple Domain allows you having more than one domain in a single WordPress installation. This plugin doesn’t support
more than one theme or advanced customizations for each domain. It’s only intended to enable constant navigation under
many domains. For a more complex setup, there is
WordPress Multisite (MU).
When there is more than one domain set in your host, all links and resources will point to the default domain. This is
the default WordPress behavior. With Multiple Domain installed and properly configured, it’ll update all link on the
fly. This way, the user navigation will be end-to-end under the same domain.
You can also set an optional base URL. If you want only a set of URL’s available under a given domain, you can use this
restriction.
Additionally, a language can be set for each domain. The language will be used to add <link>
tags with hreflang
attribute to document head. This is for SEO purposes.
Follow the steps below to install the plugin:
/wp-content/plugins/multiple-domain
directory, or install the plugin through theFeel free to open a pull request to address any of the
issues reported by the plugin users. In case you have questions
on how to fix or the best approach, start a discussion on the appropriate thread.
If you want to add a new feature, please open an issue
explaining the feature and how it would help the users before start writing your code.
Donations
If you find this plugin helpful, you can support the work involved buying me a coffee, beer or a Playstation 4 game.
You can send donations over PayPal to [email protected].
No. You have to set additional domains, DNS, and everything else to use this plugin.
Nope. If you want a complex set up like this, you may be interested in WordPress Multisite. It’s delivered with every
WordPress installation since 3.0, you can find more info here: https://codex.wordpress.org/Create_A_Network.
Absolutely. You can use the MULTIPLE_DOMAIN_DOMAIN
and MULTIPLE_DOMAIN_ORIGINAL_DOMAIN
constants to get the current
and original domains. Just notice that since the value of the first one is checked against plugin settings, it may not
reflect the actual domain in HTTP_HOST
element from $_SERVER
or user’s browser. They also may include the host port
when it’s different than 80 (default HTTP port) or 443 (default HTTPS port).
Notice: in prior versions these constants were wrongly prefixed with MULTPLE_
, missing the “I”. The old constants
are now deprecated. They still available for backcompat but will be removed in future releases.
Yes. You can use the multiple_domain_redirect
action to do that. Please check
https://github.com/straube/multiple-domain/issues/2 for an example on how to do that.
Yes. You can use the MULTIPLE_DOMAIN_DOMAIN_LANG
constant to get the language associated with the current domain. Keep
in mind the value in this constant doesn’t necessarily reflect the actual user language or locale. This is just the
language set in the plugin config. Also notice the language may be null
.
Notice: in prior versions these constants were wrongly prefixed with MULTPLE_
, missing the “I”. The old constants
are now deprecated. They still available for backcompat but will be removed in future releases.
Yes. There is a shortcode available for that. Just add [multiple_domain]
to the post/page and it’ll be replaced by
the current domain when viewing the content. You can write things like “Welcome to [multiple_domain]!”, which would be
rendered as “Welcome to mydomain.com!”.
Any domain you’re site is served from must be added to the plugin configuration. Even www
variations and the original
domain where your WordPress was installed in must be added. You’ll probably see some unexpected output when accessing
the site from a non-mapped domain.
Yes. You may notice that even if you don’t set a language for any domain, you still get a default hreflang
tag in
your page head. To disable this behavior, follow the instructions from
https://github.com/straube/multiple-domain/issues/51.
Under certain circumstances, in the case of a wrong configuration, you may not be able to log in to the admin area
and your page will be redirected. In this case, there are two ways to solve this.
wp-content/plugins/multiple-domain
. You should be able to do that from the hostingDELETE FROM {YOUR-PREFIX}_options
WHERE option_name LIKE 'multiple-domain-%'
; (Remember to replace the prefix from your own table name). This can beMULTPLE_
are now deprecated. They have a matching MULTIPLE_
prefixed constant.MULTPLE_
, changed to MULTIPLE
.false
.hreflang
tags.%%multiple_domain%%
advanced variable for Yoast.getDomainBase($domain = null)
.<body>
tag containing the domain name (e.g. multipled-domain-name-tld
) to allow front-end customizations.initAttributes
method.[multiple_domain]
shortcode to show the current language.MultipleDomain
class to its own file.filter_input
from plugin.MULTIPLE_DOMAIN_DOMAIN_LANG
constant for theme/plugin customization.MULTIPLE_DOMAIN_ORIGINAL_DOMAIN
constant to hold the original WP home domain.multiple_domain_redirect
action.MULTIPLE_DOMAIN_DOMAIN
constant for theme/plugin customization.This is the first release. It supports setting domains and an optional base URL for each one.