|
1 | | -# Short links for URLs in the book |
| 1 | +This file is deployed as `.htaccess` to the FPY.LI domain |
| 2 | +to map short URLs in Fluent Python to the original URLs. |
2 | 3 |
|
3 | | -## Problem: link rot |
| 4 | +To update it, I use tools in this other repo: |
4 | 5 |
|
5 | | -_Fluent Python, Second Edition_ has more than 1000 links to external resources. |
6 | | -Inevitably, some of those links will rot as time passes. |
7 | | -But I can't change the URLs in the print book... |
8 | | - |
9 | | -## Solution: indirection |
10 | | - |
11 | | -I replaced almost all URLs in the book with shortened versions that go through the `fpy.li` site which I control. |
12 | | -The site has an `.htaccess` file with *temporary* redirects. |
13 | | - |
14 | | -When I find out a link is stale, I can thange the redirect in `.htaccess` to a new target, |
15 | | -which may be a link to copy in the Internet Archive's |
16 | | -[Wayback Machine](https://archive.org/web/) |
17 | | -o the link in the book is back in service through the updated redirect. |
18 | | - |
19 | | - |
20 | | -## Help wanted |
21 | | - |
22 | | -Please report broken links as bugs in the [`FPY.LI.htaccess`](FPY.LI.htaccess) file. |
23 | | -Also, feel free to send pull requests with fixes to that file. |
24 | | -When I accept a PR, I will redeploy it to `fpy.li/.htaccess`. |
25 | | - |
26 | | - |
27 | | -## Details |
28 | | - |
29 | | -Almost all URLs in the book are replaced with shortened versions like |
30 | | -[`http://fpy.li/1-3`](http://fpy.li/1-3)—for chapter 1, link #3. |
31 | | - |
32 | | -There are also custom short URLs like |
33 | | -[`https://fpy.li/code`](https://fpy.li/code) which redirects to the example code repository. |
34 | | -I used custom short URLs for URLs with 3 or more mentions, or links to PEPs. |
35 | | - |
36 | | -Exceptions: |
37 | | - |
38 | | -- URLs with `oreilly` in them are unchanged; |
39 | | -- `fluentpython.com` URL (with no path) is unchanged; |
40 | | - |
41 | | -The `custom.htaccess` file contains redirects with custom names |
42 | | -plus numbered URLs generated from the links in each chapter in |
43 | | -the Second Edition in English. |
44 | | - |
45 | | -`short.htaccess` has redirects made by `short.py`, starting |
46 | | -with the Second Edition in Brazilian Portuguese. |
47 | | - |
48 | | -```shell |
49 | | -cat custom.htaccess short.htaccess > FPY.LI.htaccess |
50 | | -``` |
51 | | - |
52 | | -`FPY.LI.htaccess` is deployed at the root folder in `http://fpy.li`. |
| 6 | +https://github.com/pythonfluente/pythonfluente2e |
0 commit comments