Sphinx Redirect Extension

0.3.0 · active · verified Fri Apr 17

sphinxext-rediraffe is a Sphinx extension that generates HTTP redirects (via HTML meta refresh tags) for non-existent pages, pointing them to specified working pages. This is useful for maintaining SEO and user experience when restructuring documentation. It is currently at version 0.3.0 and typically releases updates as needed for bug fixes, compatibility with new Sphinx versions, or minor features.

Common errors

Warnings

Install

Imports

Quickstart

To quickly set up `sphinxext-rediraffe`, first add it to your `extensions` list in `conf.py`. Then, configure the `rediraffe_redirects` setting, either by pointing it to a text file (e.g., `redirects.txt`) where each line specifies an old path followed by a new path, or by providing a dictionary directly in `conf.py`.

# conf.py
extensions = [
    'sphinxext.rediraffe',
]

# Option 1: Path to a text file with redirects (preferred for many redirects)
rediraffe_redirects = "redirects.txt"

# Option 2: A dictionary mapping old paths to new paths (for fewer redirects)
# rediraffe_redirects = {
#     "old/page": "new/page.html",
#     "legacy_docs/index": "current_docs/welcome.html",
# }

# --- redirects.txt (example content, place in your source directory) ---
# old/path/to/file new/path/to/target.html
# old_directory/some_page new_directory/another_page.html
# old/index new/home.html
# A comment line starts with a hash

view raw JSON →