Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

BenWard/shrtr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shrtr

Shrtr is a small rack appliance to handle redirects between short URL paths on one domain, to full URLs on any other.

It reads in a Yaml configuration file containing static mappings, and will 301 redirect to the destination when provided.

Any other URL is redirected to a specified fall-back.

The YML mappings for my own use are generated by a Jekyll static site, but could either represent a manual list, or be replaced with a base-60 conversion where IDs make for appropriate slugs.

Configurationb

Configure config/shrtr.yml to point to your source of short URL mappings, and the URL to redirect to in the event of a missing mapping (e.g. 404 handler on your site.)

The mappings file is a simple YAML configuration file:

shorturls:
  -
    id: 1dkfL_
    url: https://example.com/full/article/23235.html
  -
    id: 1qnuL0
    url: https://example.com/full/article/523232.html
  -
    id: 1oY6A0
    url: https://example.com/full/article/51212.html

Running

Run the appliance via thin:

thin -R ./config.ru start

shrtr watches the mappings file for changes, and reload it when updated.

About

Shrtr: A tiny, tiny-URL appliance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages