<div align="center">

![Project hero image](https://github.com/documatt/sphinx-reredirects/blob/main/docs/_static/hero.svg?raw=true)

# sphinx-reredirects

<!-- Major intro -->

**The extension for Sphinx documentation projects that handle redirects for moved pages. It generates HTML pages with meta refresh redirects to the new page location to prevent 404 errors if you rename or move your documents.**

<!-- Minor intro -->

The sphinx-reredirects started from the urge to manage redirects for all documents after moving our _Tech writer at work_ blog to the new address at https://documatt.com/blog/.

<!-- Highlights in points -->

_Prevents 404 errors · Wildcard matching · Dynamic placeholders_\
_Cross-domain redirects · Centralized configuration in `conf.py`_\
_Easy to use · Works seamlessly with Sphinx_\
_[📚 Documentation](https://documatt.com/sphinx-reredirects) · [📟 Source code](https://github.com/documatt/sphinx-reredirects)_

<!-- Badges -->

[![GitHub Repo stars](https://img.shields.io/github/stars/documatt/sphinx-reredirects?style=flat&logo=github&labelColor=097cba&color=163B36)](https://github.com/documatt/sphinx-reredirects)
[![GitHub tests](https://github.com/documatt/sphinx-reredirects/actions/workflows/test.yml/badge.svg)](https://github.com/documatt/sphinx-reredirects/actions/workflows/test.yml)
[![PyPI version](https://img.shields.io/pypi/v/sphinx-reredirects?labelColor=097cba&color=163B36)](https://pypi.org/project/sphinx-reredirects/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-reredirects?labelColor=097cba&color=163B36)](https://pypi.org/project/sphinx-reredirects/)
[![MIT licence](https://img.shields.io/badge/license-MIT-blue?labelColor=097cba&color=163B36)](https://raw.githubusercontent.com/documatt/sphinx-reredirects/refs/heads/main/LICENSE)
[![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)

</div>

<!-- Very short intro -->

Good URLs are never changing URLs. But if you must, sphinx-reredirects helps you manage redirects with ease and from a single place in the project's `conf.py`.

For example, if you rename document `start` to `intro`, and tell it to sphinx-reredirects, it will generate the HTML page `start.html` with client-side redirect (requires no server-side configuration).

The extension supports wildcards and moving to different domains, too.

<!-- Screenshot / video -->

![Terminal showing `cat images.html` ( content of generated redirect HTML file)](https://github.com/documatt/sphinx-reredirects/blob/main/docs/_static/screenshot.png?raw=true)

## Community

Connect with other fellows who are building with Sphinx. Share knowledge, get help,
and contribute to the open-source project. Check out
our [Documatt Community](https://documatt.com/community) page to see featured material and upcoming events.

Join our community here:

- 🌟 [Explore our GitHub](https://github.com/documatt)
- 📥 [Subscribe to our newsletter](https://documatt.com/newsletter-signup/)
- 🐦 [Follow us on X](https://x.com/documattcom)
- 🕴️ [Follow us on LinkedIn](https://www.linkedin.com/company/documattcom)
- 📺 [Subscribe to our YouTube channel](https://www.youtube.com/@Documatt)
- 📚 [Read our blog posts](https://documatt.com/blog)

## Legal

sphinx-reredirects is [MIT licensed](https://raw.githubusercontent.com/documatt/sphinx-reredirects/refs/heads/main/LICENSE).

Icon "route-alt-right" by [TabletIcons](https://tablericons.com/icon/route-alt-right).
