Routing

Routing can be used to rewrite URLs. In this section you will learn how to rewrite the partner rating URLs using Routing Enhancers and Aspects. TYPO3 Explained has a chapter Introduction to routing that you can read if you are not familiar with the concept yet. You will no longer need third party extensions like RealURL or CoolUri to rewrite and beautify your URLs.

How to rewrite URLs with partner rating parameters

On setting up your page you should already have created a site configuration. You can do this in the backend module Site Managements > Sites.

Your site configuration will be stored in /config/sites/<your_identifier>/config.yaml. The following configurations have to be applied to this file.

Any URL parameters can be rewritten with the Routing Enhancers and Aspects. These are added manually in the config.yaml:

Add the following YAML configuration under routeEnhancers:

/config/sites/<your_identifier>/config.yaml
 1routeEnhancers:
 2  PartnerRating:
 3    type: Extbase
 4    limitToPages:
 5      - 1
 6    extension: PartnerRating
 7    plugin: Pi1
 8    routes:
 9      -
10        routePath: /
11        _controller: 'Rating::list'
12      -
13        routePath: '/{department}'
14        _controller: 'Rating::show'
15        _arguments:
16          department: department
17    defaultController: 'Rating::list'
18    aspects:
19      department:
20        type: PersistedAliasMapper
21        tableName: tx_partnerrating_domain_model_department
22        routeFieldName: slug