11# EXT: host_variants
22
3- This extension allows to configure a base variant in TYPO3s Site Configuration depending on the current Host.
3+ This extension allows to configure a base variant in TYPO3s Site Configuration depending
4+ on the current Host.
5+
6+ ## When is it useful?
7+
8+ This extension can be useful when dealing with multiple sites in one TYPO3 instance
9+ with different domains:
10+
11+ Let's say you have a primary domain ` primary-domain.tld ` with a site configuration.
12+ Backend editors log in to this primary domain.
13+
14+ You have a site config with an own page tree for a second domain ` another-domain.tld ` .
15+ Editors create content for the second domain on a hidden page. When previewing that
16+ page from within the backend, ` another-domain.tld/some-page-slug ` will be shown. Since
17+ editors are logged in to the primary domain, the backend user cookie will not be sent by
18+ the browser for the secondary domain, the frontend does not see a logged in backend
19+ user and will show a 404.
20+
21+ The extension now allows configuring a site base variant for the secondary domain that
22+ kicks in when backend preview is called from the main domain, and calls the frontend
23+ of the secondary site as a sub path of the main domain instead.
24+
425
526## Requirements
627
7- * TYPO3 9 LTS, 10 LTS or 11.0
28+ * TYPO3 9 LTS, 10 LTS, 11 LTS, 12 LTS
829
930## Installation and Setup
1031Install the extension via your preferred way. No further setup is required.
@@ -16,20 +37,30 @@ This allows configuring multiple domains for the same root page.
1637
1738## Example
1839
40+ Basic:
41+
1942``` yaml
20- base : ' https://main -domain.tld/'
43+ base : ' https://another -domain.tld/'
2144baseVariants :
2245 -
23- base : ' https://another-domain.tld/'
24- condition : ' host == "another-domain.tld"'
46+ base : ' https://primary-domain.tld/some-sub-path'
47+ condition : ' host == "primary-domain.tld"'
48+ ` ` `
49+
50+ Using some ENV variable:
51+
52+ ` ` ` yaml
53+ base : ' https://another-domain.tld/'
54+ baseVariants :
2555 -
26- base : ' http ://%env(DYNAMIC_DOMAIN )%/'
27- condition : ' host == "%env(DYNAMIC_DOMAIN )%"'
56+ base : ' https ://%env(MAIN_DOMAIN )%/some-sub-path '
57+ condition : ' host == "%env(MAIN_DOMAIN )%"'
2858` ` `
2959
30- Conditions can also be combined:
60+ Combining conditions:
61+
3162` ` ` yaml
32- base : ' https://main -domain.tld/'
63+ base : ' https://another -domain.tld/'
3364baseVariants :
3465 -
3566 base : ' https://local1.local/'
0 commit comments