You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3:RealURL与tx_news重复斜杠问题已解决但求原理

Fixing Double Slashes in tx_news URLs with RealURL (domain.com/post//post-title)

Hey there, let's break down why you were seeing those frustrating double slashes in your tx_news URLs and why adjusting the tx_news_pi1[action] configuration in RealURL fixed the issue—since you're new to PHP and TYPO3's RealURL setup, I'll keep this straightforward and practical.

The Problem Recap

When following the official tx_news docs for RealURL configuration, you encountered a URL formatting bug: URLs for news items ended up looking like domain.com/post//post-title instead of the clean domain.com/post/post-title. You tested and found that either moving the tx_news_pi1[action] entry in fixedPostVars after tx_news_pi1[news], or deleting the action config entirely, resolved the double slash problem.

Why This Happens

RealURL processes the fixedPostVars in the exact order you list them—and that's where the issue originated. Here's the play-by-play:

  • When tx_news_pi1[action] is placed before tx_news_pi1[news], RealURL tries to generate a URL segment for the action (like "detail") first. But in most tx_news setups, the presence of a news item ID/slug already tells TYPO3 to load the detail view automatically. This means the action parameter doesn't need a visible URL segment, so RealURL creates an empty placeholder instead.
  • Next, when it processes tx_news_pi1[news] (the news item's title/slug), it appends that segment right after the empty action placeholder. That empty spot translates to a double slash in the final URL.
  • The key point: your setup didn't actually need the explicit action segment in the URL, so keeping that config in the wrong order forced RealURL to add an unnecessary empty segment.

The Fixes (Recapped & Explained)

  • Option 1: Reorder your fixedPostVars
    Move the tx_news_pi1[action] entry to come after tx_news_pi1[news] in your RealURL config. By processing the news slug first, TYPO3 infers the correct action automatically, so the action parameter doesn't create an empty segment—eliminating the double slash.
  • Option 2: Remove the tx_news_pi1[action] config
    If your site doesn't require showing the action (like "detail") in the URL (which is the standard setup for tx_news), deleting this line entirely removes the empty placeholder that was causing the double slash issue.

内容的提问来源于stack exchange,提问作者josias

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 09:04:59