Skip to main navigation Skip to main content Skip to page footer

Human-readable URLs

General

The URL hashes in the URLs in the vehicle search are mainly used for routing, which then determines the state of the single-page vehicle search. The vehicle search generally knows the following states:

  • #list
  • #details
  • #bookmarks
  • #request
  • #research

These states are linked to the URLs configured in the TypoScript constants in order to adapt URLs to your own requirements. We assume that your vehicle search plugin is placed on the page https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/. Thus, the behavior is as follows:

  • If the value https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/ is defined in the constant {$themes.configuration.extension.fahrzeugsuche.urls.list}, then the vehicle search uses the URL https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/#list for back buttons to the list, for example.
  • If the value https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/fahrzeug-details/%1$s is defined in the constant {$themes.configuration.extension.fahrzeugsuche.urls.details}}, then the vehicle search uses the URL https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/fahrzeug-details/A123456#details-super-modernes-auto
  • etc.

Info:

For a detailed URL such as https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/fahrzeug-details/A123456#details-super-modernes-auto or https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/?tx_fahrzeugsuche_fahrzeugsuche[fahrzeug]=%1$s#details-super-modernes-auto, the vehicle parameter is first evaluated on the server side. If this parameter is present and valid, it is passed to the vehicle search via the data-fahrzeugsuche-show-fahrzeug-on-initialization attribute. This then opens the specified vehicle directly when loading. If no valid vehicle parameter is present, the vehicle search attempts to find the vehicle to be loaded via URL hash.

A simple TypoScript condition can be used for the constants between the production and development environment:

#
# Fahrzeugsuche URLs
themes.configuration.extension.fahrzeugsuche.urls.request = https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/fahrzeug-anfrage/%1$s
themes.configuration.extension.fahrzeugsuche.urls.list = https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/
themes.configuration.extension.fahrzeugsuche.urls.research = https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/suchauftrag/
themes.configuration.extension.fahrzeugsuche.urls.sitemap = https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/fahrzeug-details/%1$s
themes.configuration.extension.fahrzeugsuche.urls.details = https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/fahrzeug-details/%1$s
themes.configuration.extension.fahrzeugsuche.urls.bookmarks = https://www.typo3-fahrzeugsuche.de/fahrzeugsuche/merkzettel/
#
# Local DDEV
[request.getHeaders()['host'][0] == 'fahrzeugsuche.ddev.site']
    themes.configuration.extension.fahrzeugsuche.urls.request = https://fahrzeugsuche.ddev.site/fahrzeugsuche/fahrzeug-anfrage/%1$s
    themes.configuration.extension.fahrzeugsuche.urls.list = https://fahrzeugsuche.ddev.site/fahrzeugsuche/
    themes.configuration.extension.fahrzeugsuche.urls.research = https://fahrzeugsuche.ddev.site/fahrzeugsuche/suchauftrag/
    themes.configuration.extension.fahrzeugsuche.urls.sitemap = https://fahrzeugsuche.ddev.site/fahrzeugsuche/fahrzeug-details/%1$s
    themes.configuration.extension.fahrzeugsuche.urls.details = https://fahrzeugsuche.ddev.site/fahrzeugsuche/fahrzeug-details/%1$s
    themes.configuration.extension.fahrzeugsuche.urls.bookmarks = https://fahrzeugsuche.ddev.site/fahrzeugsuche/merkzettel/
[global]

Furthermore, URLs are provided in the classic way via routes, which is discussed in the next section.

Slug configuration (since TYPO3 9.5)

routeEnhancers:
  PageTypeSuffix:
    type: PageType
    map:
      fahrzeugsuche-sitemap.xml: 1519148087
      fahrzeugsuche.json: 1469968203
  FahrzeugsucheDetailsPlugin:
    type: Extbase
    extension: Fahrzeugsuche
    plugin: Fahrzeugsuche
    routes:
      -
        routePath: '/fahrzeug-details/{fahrzeug_id}'
        _controller: 'Fahrzeugsuche::search'
        _arguments:
          fahrzeug_id: fahrzeug
      -
        routePath: '/fahrzeug-pdf/{account_id}/{fahrzeug_id}'
        _controller: 'Fahrzeugsuche::createPdf'
        _arguments:
          account_id: account
          fahrzeug_id: fahrzeugId
      -
        routePath: '/fahrzeug-bookmarks-pdf/{bookmarks}'
        _controller: 'Fahrzeugsuche::createBookmarksPdf'
        _arguments:
          bookmarks: bookmarks
    defaultController: 'Fahrzeugsuche::search'
    requirements:
      account_id: '^[a-zA-Z0-9].*$'
      fahrzeug_id: '^[a-zA-Z0-9].*$'
      bookmarks: '^[a-zA-Z0-9].*$'

Realurl configuration (up to TYPO3 9.5)

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
    '_DEFAULT' => array (
        'postVarSets' => array (
            '_DEFAULT' => array (
                // EXT:fahrzeugsuche start
                'fahrzeug-details' => array(
                    array(
                        'GETvar' => 'tx_fahrzeugsuche_fahrzeugsuche[fahrzeug]',
                    ),
                ),
                'fahrzeug-pdf' => array(
                    array(
                        'GETvar' => 'tx_fahrzeugsuche_fahrzeugsuche[controller]',
                        'valueMap' => array(),
                        'noMatch' => 'bypass',
                    ),
                    array(
                        'GETvar' => 'tx_fahrzeugsuche_fahrzeugsuche[action]',
                        'valueMap' => array(
                            'pdf' => 'createPdf',
                            'bookmarks-pdf' => 'createBookmarksPdf',
                        ),
                        'noMatch' => 'bypass',
                    ),
                    array(
                        'GETvar' => 'tx_fahrzeugsuche_fahrzeugsuche[account]',
                    ),
                    array(
                        'GETvar' => 'tx_fahrzeugsuche_fahrzeugsuche[fahrzeugId]',
                    ),
                ),
                // EXT:fahrzeugsuche end
            ),
        ),
    ),
);