Reputation: 349
I know, I can run in one t3 installation severl root pages so I am able to adminstrate all via one Backend.
But that's not wat I want to do.
I have one T3 installation with only one root page.
I would like to access the site via https://www.example.com and also via https://www.otherexample.com
I have setup apache with virtual host (already known since years) and server aliases.
DNS is setup accordingly.
I can see both request coming in - one working - and the other brings an error: "no site configuration ...".
Redirects work. But there should be a way without redirects.
Any help appreciated. Regards Kallewirsch
Upvotes: 0
Views: 512
Reputation: 2921
You can use environment variables in baseVariants
s' condition
s.
Using /
as base
is really not recommended for live sites (expect problems with canonical URLs, hreflangs and in CLI context).
# this makes sure CLI has a valid domain, too (none of the other conditions will match)
base: 'https://www.my.site/'
baseVariants:
# you have been warned about duplicate content etc.
- base: 'https://my.other.site/'
condition: 'getenv("HTTP_HOST") == "https://my.other.site/"'
# this is actually a valid use case: your local test system via a dynamic domain from
# ngrok.io (to have a look at it in browserstack.com, show it to clients or team members
# etc.)
- base: /
condition: 'applicationContext matches "#^.*/Local$#" && getenv("HTTP_HOST") matches "#\.ngrok\.io$#"'
# this is an example for your local development site
- base: 'https://my.ddev.site'
condition: 'applicationContext matches "#/Local$#"'
Depending on your environment you might have to use getenv("SERVER_NAME")
, getenv("X-Forwarded-Host")
etc.
Upvotes: 0
Reputation: 2432
In general the best solution is to have just one primary domain as this reduces confusion by visitors and eases search engine indexing. That would mean that all your virtual hosts redirect to the primary domain, thus you would create two apache entries, a first one for the primary domain and a second one to catch all other with all aliases, redirecting to the first. Then in TYPO3 you can define the site with your primary domain.
If you really need to do this differently, you can define a TYPO3 site configuration with a baseurl of just /
, leaving out the domain.
Upvotes: 1