.. include:: /Includes.rst.txt .. _routing: 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 :ref:`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: 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 :guilabel:`Site Managements > Sites`. Your site configuration will be stored in :file:`/config/sites//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 :file:`config.yaml`: Add the following YAML configuration under :yaml:`routeEnhancers`: .. code-block:: yaml :linenos: :caption: :file:`/config/sites//config.yaml` routeEnhancers: PartnerRating: type: Extbase limitToPages: [1] extension: PartnerRating plugin: Pi1 routes: - routePath: '/' _controller: 'Rating::list' - routePath: '/{department_title}' _controller: 'Rating::show' _arguments: department_title: 'department' - routePath: '/{department_title}/saved/{saved_rating}' _controller: 'Rating::show' _arguments: department_title: 'department' saved_rating: 'savedRating' - routePath: '/{department_title}/send' _controller: 'Rating::save' _arguments: department_title: 'department' defaultController: 'Rating::show' aspects: department_title: type: PersistedAliasMapper tableName: tx_partnerrating_domain_model_department routeFieldName: slug saved_rating: type: PersistedAliasMapper tableName: tx_partnerrating_domain_model_rating routeFieldName: uid .. _hint: Hint ---- The URL path `/saved/` is set by the Route Enhancer, but does not appear in the browser because this path section is removed from the URL in the browser's address bar immediately after the page is reloaded using the History API. This way, the nice section URLs are preserved without additional sections.