定制 a9f/typo3-better-redirects 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

a9f/typo3-better-redirects

Composer 安装命令:

composer require a9f/typo3-better-redirects

包简介

Improved redirects handling for TYPO3, including optimized caching for large numbers of redirects

README 文档

README

A TYPO3 extension that replaces the built-in redirect matching with a multi-layer caching strategy optimized for large redirect sets (thousands of entries). Designed for TYPO3 13.4+ with the redirects system extension.

The Problem

TYPO3's default RedirectService queries and evaluates all redirects on every request. This works fine for small sets but becomes a bottleneck at scale.

How It Works

Redirect matching flows through three layers, each falling back to the next on a miss:

  1. Per-request result cache — database-backed cache keyed by (host, path, query), TTL up to 24 hours. Avoids repeated matching for frequently-hit URLs.
  2. PHP file cache — redirect data is compiled into PHP files in var/cache/code/better_redirects/ that are loaded and optimized by OPcache. Redirects are grouped by match type and organized into trie or hash structures for fast lookup. Files are sharded automatically when a type exceeds the threshold (default: 1,000 entries per type).
  3. TYPO3's default RedirectService — fallback if the PHP file cache is unavailable or cold.

Cache invalidation is automatic: when a redirect record is saved or deleted via the TYPO3 backend, the result cache entries and the PHP file cache for that host are flushed immediately.

Important Notes

The extension is active as soon as it is installed. No configuration is required.

TYPO3's built-in redirect cache (RedirectCacheService) is superseded by the PHP file cache and effectively becomes irrelevant. The built-in cache is still rebuilt on redirect changes (because the extension subclasses RedirectCacheService), but redirect matching never reaches it under normal operation.

The extension aliases RedirectService and RedirectCacheService to its own subclasses via Symfony DI. Any code that injects these classes by their concrete TYPO3 type will transparently receive the caching variants.

Installation

composer require a9f/typo3-better-redirects

Activate the extension in the TYPO3 Extension Manager or via:

bin/typo3 extension:activate better_redirects

No additional configuration is required. The PHP file cache is populated automatically on the first request after installation (or after a cache flush).

Configuration

One optional setting is available via $GLOBALS['TYPO3_CONF_VARS']:

Key Default Description
EXTENSIONS/better_redirects/splitThreshold 1000 Number of redirects per match-type bucket above which the generated PHP file is split into shards

Set it in config/system/additional.php (or equivalent):

$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['better_redirects']['splitThreshold'] = 500;

Requirements

  • TYPO3 13.4
  • typo3/cms-redirects system extension
  • PHP 8.2+
  • OPcache recommended (the PHP file cache provides no benefit without it)

统计信息

  • 总下载量: 646
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-04-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固