Redirect Manager

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

Overview

The Redirect Manager module enables administrators to manage 301 and 302 redirects with hit tracking and wildcard support. This functionality operates through a file-based storage system rather than database entries.

Architecture

The system stores all redirects in a single JSON file located at:

wp-content/functionalities/redirects.json

Core Features

  • Hit Tracking — Real-time counter for each redirect usage
  • File-Based Storage — High-performance JSON file (cached with transients)
  • Wildcard Support — Use * suffix for path prefix matching
  • Multiple Types — Supports 301, 302, 307, and 308 redirects
  • Enable/Disable — Temporarily disable without deleting

Redirect Type Reference

  • 301 — Permanent → Page permanently moved (passes SEO value)
  • 302 — Temporary → Temporary redirect
  • 307 — Temporary Redirect → Preserves request method (POST stays POST)
  • 308 — Permanent Redirect → Permanent version of 307

Wildcard Matching

The module supports asterisk-based pattern matching:

  • *`/old-blog/** —/old-blog/post-1,/old-blog/category/tech`, etc.
  • *`/docs/v1/** —/docs/v1/api,/docs/v1/guide/intro`, etc.

Performance Optimizations

  • Early Hooktemplate_redirect at priority 1
  • Admin Skip — No processing in admin area
  • Fast Lookup — Exact match check before wildcard iteration
  • Transient Cache — 12-hour cache for redirect data