---
title: "Feature: #92780 - Introduce event after page URI generation"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-92780-1761709200"
source: "Changelog/14.2/Feature-92780-IntroduceAfterPageUriGeneratedEvent.rst"
typo3-version: "14.2"
typo3-major: 14
type: "feature"
issue: 92780
forge: "https://forge.typo3.org/issues/92780"
tags: ["PHP-API", "ext:core"]
rendered: "2026-10-01T19:27:47+00:00"
---

# Feature: #92780 - Introduce event after page URI generation {#feature-92780-1761709200}

See [forge#92780](https://forge.typo3.org/issues/92780)

## Description {#description}

A new PSR-14 event
`\TYPO3\CMS\Core\Routing\Event\AfterPageUriGeneratedEvent` is
dispatched in `\TYPO3\CMS\Core\Routing\PageRouter::generateUri()`.

The event provides access to the generated URI and the arguments passed to
`generateUri()`. Listeners can inspect and replace the generated URI.
The `parameters` payload reflects the sanitized query arguments after
handling special parameters such as `id` and `_language`.

The event has the following methods:

-   `getUri()` and `setUri()`
-   `getRoute()`
-   `getParameters()`
-   `getFragment()`
-   `getType()`
-   `getLanguage()`
-   `getSite()`

> [!WARNING]
> **Attention**
>
> `PageRouter::generateUri()` is called from many different contexts
> across TYPO3 core, not only during frontend page rendering. This event
> therefore fires for URIs generated in the backend, including page preview,
> FormEngine, new-record redirects, workspace preview links, XML sitemaps,
> redirect source detection, webhook payloads, and error handlers, among
> others.
>
> Listeners that modify the URI must therefore be context-aware. Use
> `getType()` (see
> `\TYPO3\CMS\Core\Routing\RouterInterface`) to distinguish between
> an absolute URL (`RouterInterface::ABSOLUTE_URL`) and an absolute
> path (`RouterInterface::ABSOLUTE_PATH`), and use
> `getSite()`, `getLanguage()`, or `getRoute()` to limit
> modifications to the intended context. Unconditionally replacing URIs can
> break backend previews, sitemaps, or other subsystems in non-obvious ways.

When replacing the URI, listeners must ensure that the returned URI is valid in
their setup and remains routable.

Example listener registration:

```php
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Routing\Event\AfterPageUriGeneratedEvent;
use TYPO3\CMS\Core\Routing\RouterInterface;

#[AsEventListener('my-extension/after-page-uri-generated')]
final readonly class MyListener
{
    public function __invoke(AfterPageUriGeneratedEvent $event): void
    {
        // Only act on absolute URLs
        if ($event->getType() !== RouterInterface::ABSOLUTE_URL) {
            return;
        }

        // Inspect or replace $event->getUri()
    }
}
```

## Impact {#impact}

Extension authors can now react to generated page URIs for use cases such as
logging, monitoring, debugging, and URL adjustment. Because the event is
dispatched in all contexts that use `PageRouter::generateUri()`, including
the backend and various subsystems, listeners should scope their modifications
carefully.
