Sphinx Reredirects is a Sphinx extension that generates HTML pages with meta refresh redirects for moved or renamed documentation pages, preventing 404 errors. It is currently at version 1.1.0 and is actively maintained with irregular but frequent releases.
pip install sphinx-reredirectsVerified import paths — ran on the pinned version, not inferred.
To use sphinx-reredirects, first ensure it's added to your `extensions` list in `conf.py`. Then, define the `redirects` dictionary in the same file, mapping old Sphinx document names (without extensions) to their new relative or absolute URL targets. Wildcards and placeholders are supported.
Ensure your environment meets Python >= 3.11 and Sphinx >= 7.4. Upgrade Sphinx using `pip install -U sphinx` if necessary.
Be aware that redirects are only generated for HTML output. This is by design, as meta refresh redirects are an HTML-specific mechanism.
Plan your redirects carefully. If you intend to redirect an *existing* document, understand that its original content will no longer be accessible at that path in the built output.
Manually verify internal redirects or use other tools. The extension cooperates with `linkcheck` for external redirects.
Upgrade to `sphinx-reredirects` version 0.1.6 or newer, as this feature was added and is now the default behavior. For older versions, a custom HTML template was required.