Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy
Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy, which allows for vanity URLs. Examples:
example.com-> resolves to home page
example.com/shop/store-> Resolves to a Store page
example-store.com-> Shows content for
example-store.com/checkout-> Shows content for
Each domain is identified by a key. You must define one domain using the
primary key to mark it as the primary domain.
MultiDomain: domains: primary: hostname: 'example.com' store: hostname: 'example-store.com' resolves_to: 'shop/store' ```
allow_subdomains: If true, domain matching is subdomain agnostic, so that anything.example.com still maps to example.com, the primary domain in the above configuration.
Sometimes you may have routes that should resolve normally, and bypass the multidomain filter. In this case, for any given domain, you can specify an
In the above example, any URL beginning with
Security/ or matching
my-custom-webhook/ will resolve on any domain.
You can put your
allow node directly under
MultiDomain to have a global whitelist.
MultiDomain: allow: - 'admin/' - 'Security/' - 'my-custom-webhook/' ```
Sometimes, you may have a page that sits outside the node representing a domain, but you still want it to be considered part of that domain. For this, you can use the
In the above configuration, the page
buy-now can live in the site root, but the URL
will nonetheless resolve the page, even though the page isn't under
If you have multiple test environments, it may not make sense for you to hard code the host name in the config. Alternatively, you can define an environment variable, i.e. a constant, and refer to it as a string in the config.
Name: mymultidomain After: '#multidomain' Only:
MultiDomain: domains: primary: hostname: STAGINGPRIMARYHOSTNAME store: hostname: STAGINGSTOREHOSTNAME resolves_to: 'shop/store' force: - 'buy-now/*' ```
This way, every environment can declare its hostname independently.
Subsites creates a parallel CMS instance for a given domain name. This module allows you to map domains to a specific section of the hierarchy, in the context of all your other pages.
That works to create a vanity URL for one page, but as soon as you go deeper into the hierarchy, you return to the native URL. A more robust solution is required for persisting the vanity URLs.
Further, this module is more extensible, allowing for collaboration with other URL-hungry modules, such as Translatable or Fluent.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem