Board Index β€Ί Knowledge Base β€Ί Troubleshooting β€Ί How to Fix Malformed URLs with RecentTopics & Third-Party Extensions

How to Fix Malformed URLs with RecentTopics & Third-Party Extensions

Resolve URL parameter collisions when third-party extensions like RecentTopics append raw query strings or unread markers to rewritten SEO permalinks.

When running third-party portal or recent activity extensions alongside the phpBB SEO Framework, you may occasionally encounter malformed URLs or unexpected query string duplicates. The most frequent occurrence happens with the popular RecentTopics extension, where URLs are generated with raw query strings such as ?view=unread#unread appended to rewritten permalinks.

In this guide, we break down why query string collisions happen, how the v1.1.6 URL sanitation pipeline addresses them, and the exact steps to ensure clean permalinks board-wide.

1. Root Cause: Parameter Collisions in Rewritten Permalinks
Standard phpBB generates topic links by calling:

Code: Select all

append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '&view=unread#unread');
Under native phpBB routing, viewtopic.php handles both query parameters and hash fragments seamlessly. However, once clean SEO permalinks are activated (transforming URLs into /topic/seo-friendly-slug-123/), poorly structured third-party hooks may append parameters directly without passing them through the core URL routing events.

This causes two common symptoms:
  1. Duplicated Query Delimiters: Generating URLs like /topic/slug-123/?view=unread&sid=...#unread which can confuse search engine spiders.
  2. 301 Redirect Chains: The canonical redirect engine detects unexpected query strings and forces a 301 redirect to strip them, resulting in unnecessary HTTP round-trips.
2. The v1.1.6 Sanitization Pipeline
Starting with phpBB SEO Framework v1.1.6, a dedicated URL sanitization filter inspects incoming and outgoing links:
  • Automated Unread Post Resolution: When a request containing view=unread is received, the engine internally resolves the exact post ID (#p1234) and serves the canonical post anchor directly rather than preserving raw query arguments.
  • Query Parameter Whitelisting: Only whitelisted pagination and filtering parameters (such as start=) are appended to canonical canonical headers, keeping search engine indexation clean.
3. Step-by-Step Configuration Checklist

Step 1: Upgrade to Framework v1.1.6 or Later
Ensure your board is running the latest framework release. In ACP -> Customise -> Manage extensions, verify that phpBB SEO Framework (Lite) displays version 1.1.6 or newer.

Step 2: Inspect Apache .htaccess or Nginx Rewrite Flags
Ensure your web server rewrite rules include the Query String Append (QSA) flag so the router receives clean arguments without truncation. For Apache:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]
Step 3: Update RecentTopics Event Listeners
If you are running RecentTopics, verify that template files reference {recent_topics.U_VIEW_TOPIC} rather than hardcoded viewtopic.php?t=... links. This allows the phpBB SEO core event listener core.viewtopic_modify_page_title to intercept and rewrite the target URLs dynamically.

Step 4: Purge Board Cache
After updating extensions or templates, always purge the phpBB production cache via ACP -> General -> Resynchronise or reset statistics -> Purge the cache.

4. Need Help or Found a Conflict?
If you discover an extension that produces malformed URLs with rewritten permalinks, report it directly in our community tracker:
💬 SEO Feature Requests & Bug Reports Forum

Share this article

Share this guide with your network and community.

Was this article helpful?
Login to vote.