b13 / host-variants
Extends the base variants condition with current host.
Installs: 187 341
Dependents: 0
Suggesters: 0
Security: 0
Stars: 32
Watchers: 11
Forks: 4
Open Issues: 1
Type:typo3-cms-extension
Requires
- typo3/cms-core: ^11.4 || ^12.0.0 || ^13.0.0
This package is auto-updated.
Last update: 2024-11-01 09:14:16 UTC
README
This extension allows to configure a base variant in TYPO3s Site Configuration depending on the current Host.
When is it useful?
This extension can be useful when dealing with multiple sites in one TYPO3 instance with different domains:
Let's say you have a primary domain primary-domain.tld
with a site configuration.
Backend editors log in to this primary domain.
You have a site config with an own page tree for a second domain another-domain.tld
.
Editors create content for the second domain on a hidden page. When previewing that
page from within the backend, another-domain.tld/some-page-slug
will be shown. Since
editors are logged in to the primary domain, the backend user cookie will not be sent by
the browser for the secondary domain, the frontend does not see a logged in backend
user and will show a 404.
The extension now allows configuring a site base variant for the secondary domain that kicks in when backend preview is called from the main domain, and calls the frontend of the secondary site as a sub path of the main domain instead.
Requirements
- TYPO3 v11 LTS, v12 LTS or v13 LTS
Installation and Setup
Install the extension via your preferred way. No further setup is required. The extension works out of the box.
What it does
The extension adds a variable host
to the expression language for the Site Configuration.
This allows configuring multiple domains for the same root page.
Example
Basic:
base: 'https://another-domain.tld/' baseVariants: - base: 'https://primary-domain.tld/some-sub-path' condition: 'host == "primary-domain.tld"'
Using some ENV variable:
base: 'https://another-domain.tld/' baseVariants: - base: 'https://%env(MAIN_DOMAIN)%/some-sub-path' condition: 'host == "%env(MAIN_DOMAIN)%"'
Combining conditions:
base: 'https://another-domain.tld/' baseVariants: - base: 'https://local1.local/' condition: 'applicationContext == "Development" && host == "local1.local"' - base: 'https://local2.local/' condition: 'applicationContext == "Development" && host == "local2.local"'
Made by b13 with ♥
Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.