惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
L
LangChain Blog
M
MIT News - Artificial intelligence
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
P
Proofpoint News Feed
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
I
InfoQ
月光博客
月光博客
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
D
Docker
B
Blog

Red Blob Games: latest blog posts

Red Blob Games: English: a vs an Red Blob Games: Differential heuristics Red Blob Games: Responsive design calculator Red Blob Games: Academic citations Red Blob Games: Highlighting interactive code blocks Red Blob Games: Optimizing page size Red Blob Games: Writing a guide to SDF fonts Red Blob Games: What I did in 2025 Red Blob Games: Goodbye Sass Goodbye Sass Red Blob Games: RotMG map seeds Red Blob Games: Mapgen4 Mapgen4's use of WebGL2 Red Blob Games: Mapgen4 river shader Red Blob Games: Mapgen4 renderer Red Blob Games: Harnessing ChatGPT hallucinations Red Blob Games: Let Let's write a search engine, part 2 of 2 Red Blob Games: Let Let's write a search engine, part 1 of 2 Red Blob Games: Hexagon conversions Red Blob Games: Mapgen4 trade routes Red Blob Games: De-optimizing mapgen4 Red Blob Games: Hexagon spiral coordinates Red Blob Games: Thoughts on Flash Red Blob Games: What I did in 2024 Red Blob Games: Hexagon page animations Red Blob Games: SDF Halos SDF Halos Red Blob Games: SDF headless tests, part 2
Red Blob Games: URLs with trailing punctuation
2026-02-13 · via Red Blob Games: latest blog posts
Blog post: 12 Feb 2026

When a url is posted on a forum/chat, it’s often automatically made linkable. But sometimes the regexp that grabs the url also grabs a trailing punctuation mark. For example, if the text is “visit red blob (https://www.redblobgames.com) and scroll to the bottom” and regexp picks up the trailing parenthesis, it will make “https://www.redblobgames.com)” clickable. When you click on this, it will request GET /) which will be a 404 error.

I don’t get a lot of these in my server error logs but it’s easy to do something about it.

I use both nginx and Caddy for my web sites.

In nginx I can put a permanent rewrite inside the server block:

server {
    …
    rewrite ^(.*)[\;:,.)]$ $1 permanent;
}

In Caddy the syntax is different:

https://www.redblobgames.com {
    
    @trailing_punctuation path_regexp url ^(.*?)[;:.,\)]$
    redir @trailing_punctuation {re.url.1} 301
}

Now it will 301-redirect “https://www.redblobgames/)” to “https://www.redblobgames/”.

For both of these web servers, I never remember what characters need to be escaped, and I kind of wish I could use existing programming language syntax with delimiters like /^(.*)[;:,.)]$/ or r'^(.*)[;:,.)]$'.