Registry / web-framework / sphinx-reredirects

sphinx-reredirects

JSON →
library1.1.0pypypi✓ verified 22d ago

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-reredirects
INSTALL
IMPORT
SIG · SPHINX-REREDIRECTS
S
sphinx-reredirects
web-frameworkpythonv1.1.0
Install
5.2s avg
Import
Disk
94MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 92.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.2s · import 0.000s · 93MB
94MB installed
● package 94MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

'sphinx_reredirects'
extensions = ['sphinx_reredirects', ...]
The extension is enabled by adding its string name to the 'extensions' list in conf.py, not as a direct Python import.

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.

# In your project's conf.py file: extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx_reredirects' ] # Define your redirects. Keys are old docnames, values are new URLs. # Docnames are paths without file extensions (e.g., 'old_chapter/intro' for 'old_chapter/intro.rst'). # Targets can be relative to the project root or absolute URLs. redirects = { "old-page": "new-page.html", "removed-feature": "https://external.com/docs/new-home", "legacy/*": "current_docs/$source.html" # Wildcard example } # To build the documentation and apply redirects: # sphinx-build -M html source build
sphinx-build --version
Debug
Known issues
breakingVersion 1.0.0 introduced stricter Python and Sphinx version requirements. It now requires Python >= 3.11 and Sphinx >= 7.4.
fix
Ensure your environment meets Python >= 3.11 and Sphinx >= 7.4. Upgrade Sphinx using `pip install -U sphinx` if necessary.
affects: >=1.0.0
gotchaThe extension only supports HTML-based builders (like `html` and `dirhtml`). It performs no action when building to other outputs (e.g., `linkcheck`, `latex`).
fix
Be aware that redirects are only generated for HTML output. This is by design, as meta refresh redirects are an HTML-specific mechanism.
affects: All versions
gotchaIf a source document specified in the `redirects` configuration exists, its generated HTML file will be *overwritten* by the redirect HTML. This is intentional to ensure the redirect takes precedence.
fix
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.
affects: All versions
gotchaThe Sphinx `linkcheck` builder does not currently support checking redirects to other pages *within the same documentation project* when using `sphinx-reredirects`. It only checks redirects to external URLs.
fix
Manually verify internal redirects or use other tools. The extension cooperates with `linkcheck` for external redirects.
affects: All versions
deprecatedIn versions prior to 0.1.6, URL fragments (e.g., `#section`) were not preserved during redirects, leading to loss of specific link targets.
fix
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.
affects: <0.1.6
Upgrade
Version history
1.1.0latest on PyPI · released Dec 22, 2025
Audit
Dependencies
SphinxrequiredCore dependency for any Sphinx extension. Requires >=7.4 for v1.0.0+ and supports 9.0+ for v1.1.0.
Agent activity
7 hits · last 30 days
node
6
Resources