Base Variants

In Site Handling base variants represent different bases for you web site depending on a specified condition. For example your “live” base URL might be https://example.org but on your local machine you want https://example.test as a domain - that’s when you add a variant.

Variants consist of two parts:

  • a base to use for this variant
  • a condition that decides when this variant shall be active

Conditions are based on Symfony Expression Language and allow flexible conditions. For example:

applicationContext == "Development"

would define a base variant to use in Development context.

Add a base variant

A configured base variant for development context.

Hint

For those coming from earlier TYPO3 versions: With site handling, you do not need sys_domain records anymore! :)

Hint

Base variants exist for languages, too.

The following variables and functions are available in addition to the default symfony functionality:

Properties

typo3.version

Datatype
string
Description
The current TYPO3 version
Example
9.5.0

typo3.branch

Datatype
string
Description
The current TYPO3 branch
Example
9.5

typo3.devIpMask

Datatype
string
Description
The configured devIpMask taken from $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']
Example
77.176.160.*

applicationContext

Datatype
string
Description
The current application context
Example
Development

Functions

All functions from TYPO3s DefaultFunctionsProvider are available:

ip

Datatype
string
Description
Match an IP address, value or regex, wildcards possible. Special value: devIp for matching devIpMask .
Example
ip("77.176.160.*")

compatVersion

Datatype
string
Description
Match a TYPO3 version
Example
compatVersion("9.5.0") , compatVersion("9.4")

like

Datatype
string
Description
Comparison function to compare two strings. The first parameter is the “haystack”, the second the “needle”. Wildcards are allowed.
Example
like("foobarbaz", "*bar*")

getenv

Datatype
string
Description
Wrapper for PHPs getenv() function. Allows accessing environment variables.
Example
getenv("TYPO3_BASE_URL")