Multiple Domain

Descripción

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.

Instalación

Follow the steps below to install the plugin:

  1. Upload the plugin files to the /wp-content/plugins/multiple-domain directory, or install the plugin through the
    WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress.
  3. Use the Settings -> General screen to configure your additional domains.

Preguntas frecuentes

How can I help the plugin development?

Feel 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 gustavo.straube@gmail.com.

Does this plugin set extra domains within my host?

No. You have to set additional domains, DNS, and everything else to use this plugin.

Can I have a different theme/content/plugins for each domain?

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].

There is a way to add domain based logic to my themes?

Absolutely. You can use the MULTPLE_DOMAIN_DOMAIN constant to get the current domain. Just notice that since this
value is checked against plugin settings, it may not reflect the actual domain in HTTP_HOST element from $_SERVER or
user’s browser. It also may include the host port when it’s different than 80 (default HTTP port) or 443 (default HTTPS
port).

Can I create a custom access restriction logic for each domain?

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.

Can I get the language associated with the current domain?

Yes. You can use the MULTPLE_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.

Can I show the current domain in the content of posts or pages?

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!».

What domains should I add to the plugin setup?

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.

Can I disable hreflang tags output even for the original 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.

Reseñas

marzo 21, 2019
Seamlessly exchanges all instances, even the linktext is replaced when it is named like "www.mydomain.com". Thanks for sharing your work, Gustavo! The only thing I miss is the SEO compliance about duplicate content. I found a solution in this support thread: https://wordpress.org/support/topic/does-the-plugin-work-well-with-yoast-seo/#post-11339207 Would be great if you would consider implementing these lines of code in the next update. I implemented the proposed solution and it works absolutely fine, each page on each domain links to the canonical link. Besides this issue, everything is absolutely great!
noviembre 20, 2018
hello, I appreciate this your wonderful plugin, but am a bit confused on how I can point my second domain to my web host, to be able to use it with this plugin ( i hosted on Bluehost and got a second domain on GoDaddy), secondly am I required to input some value on the BASE/PATH option of the plugin? and if I eventually got everything right will the different domains have different post permalink?
septiembre 12, 2018
The idea and possibility of this plugin is magnificent. but for a novice user your documentation and installation instructions sucks and lacks serious details. For instance. do i need to install WordPress on all of the extra domains.? or Do i need to park my extra domains to the mast domains? or Do o need to add them as add on domain to the mast domain? In addition to all this your website is blank.. I had hoped there might be some more information. Very unprofessional Will be seeking alternative methods....
mayo 28, 2018
I'm very satisfied with the plugin. Last time when there was an issue with PHP 5.4 compatibility the fix was released almost instantly.
febrero 26, 2018
No mess - Just setup the alternative domain name in the general settings after plugin install - Ensure you server and relevant DNS is configured and it just works. Exactly as I expected it to.
Leer todas las 12 reseñas

Colaboradores y desarrolladores

“Multiple Domain” es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

Traduce “Multiple Domain” a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN , o suscríbete al log de desarrollo por RSS .

Registro de cambios

0.11.2

  • FAQ about removal of hreflang tags.
  • Fixed bug in domain replacement when it contains a slash (the regex delimiter).
  • Fixed issue in the domain replacement regex.

0.11.1

  • Fixed URI validation when there is a domain’s base restriction.

0.11.0

  • Add CHANGELOG.md file.
  • Added option to enable canonical tags.
  • Added %%multiple_domain%% advanced variable for Yoast.
  • Moved WordPress admin features to a separate class.
  • Renamed hreflang related methods.
  • Inline documentation review.
  • Minor refactoring.
  • Fixed issue with domain replacement.

0.10.3

  • Added public method to retrieve a given (or current) domain base path: getDomainBase($domain = null).
  • Minor code refactoring.

0.10.2

  • Fix minor notice message when loading the non-mapped original domain.
  • Added FAQ about plugin settings and domains.

0.10.1

  • Fix bug introduced in 0.10.0 with setups where the original domain is not present in the plugin settings.

0.10.0

  • Fix #31: Don’t add SSL when accessing via a Tor domain name
  • Moved HTML to view files.

0.9.0

  • Fixed bug in backward compatibility logic.
  • Added a class to <body> tag containing the domain name (e.g. multipled-domain-name-tld) to allow front-end customizations.

0.8.7

  • Loading Multiple Domain before other plugins to fix issue with paths.
  • Fix #38: Missing locales on language list (this issue was reopened and now it’s fixed)
  • Refactored initAttributes method.

0.8.6

  • Fix #39: Rolling back changes introduced in 0.8.4 and 0.8.5 regarding to avoid URL changes in the WP admin.

0.8.5

  • Fixed an issue introduced in 0.8.4 that breaks the admin URLs.
  • Fix #38: Missing locales on language list
  • Add [multiple_domain] shortcode to show the current language.

0.8.4

  • Fix: #36 Wrong host in URLs returned by the JSON API
  • Using singleton pattern for main plugin class.
  • Avoiding URL changes in the admin panel.

0.8.3

  • Fix: #34 hreflang tag error

0.8.2

  • Fix: #32 Image URLs not being re-written properly via Tor.

0.8.1

  • Fix: #23 Undefined index when using wp-cli.

0.8.0

  • Moved MultipleDomain class to its own file.
  • Fix: #14 Remove filter_input from plugin.
  • Attempt to fix #22.
  • Added MULTPLE_DOMAIN_DOMAIN_LANG constant for theme/plugin customization. Fixes #20.
  • Fix: #21 No ‘Access-Control-Allow-Origin’ header is present on the requested resource

0.7.1

  • Make the plugin compatible with PHP 5.4 again.

0.7

  • Code review/refactoring.
  • Added activation hook to fix empty settings bug.

0.6

  • Fix: #11 Redirect to original domain if SSL/https.

0.5

  • Added http/https for alternate link.

0.4

  • Fixed resolving host name to boolean.
  • Added Reflang links to head for SEO purpose. E.g.

0.3

  • Fixed bug when removing the port from current domain.
  • Added MULTPLE_DOMAIN_ORIGINAL_DOMAIN constant to hold the original WP home domain.
  • Allowing developers to create custom URL restriction logic through multiple_domain_redirect action.
  • Improved settings interface.

0.2

  • Improved port verification.
  • Added MULTPLE_DOMAIN_DOMAIN constant for theme/plugin customization.
  • And, last but not least, code refactoring.

0.1

This is the first release. It supports setting domains and an optional base URL for each one.