Skip to content

datasette/datasette-redirects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datasette-redirects

PyPI Changelog Tests License

Configure redirects for a Datasette instance

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-redirects

Usage

Configure redirects in your datasette.yaml configuration file. Redirects are organized by HTTP status code:

plugins:
  datasette-redirects:
    301:
      old-page: https://example.com/new-page
      another-old-page: /new-location
    302:
      temporary-page: /temporary-location

This configuration will:

  • Redirect /old-page to https://example.com/new-page with a 301 (permanent) status
  • Redirect /another-old-page to /new-location with a 301 status
  • Redirect /temporary-page to /temporary-location with a 302 (temporary) status

Both /path and /path/ variants are matched automatically - you don't need to configure both.

Development

To set up this plugin locally, first checkout the code. You can confirm it is available like this:

cd datasette-redirects
# Confirm the plugin is visible
uv run datasette plugins

To run the tests:

uv run pytest

About

Configure redirects for a Datasette instance

Resources

License

Stars

Watchers

Forks

Languages