Nginx rewrite rule (or routing) help


I’m storing my blog posts in numerical sequential order, like primary keys in a RDMS.


My permalink format is going to be as so:

I want the last portion to not matter though. In the event that I change the titles to any of my blog posts, I still want my old permalinks to work.

I want to route to

What is the best approach to achieve this? I’m not very familiar with regex and nginx rewrite rules, I’m guessing that’s the way to go about it.

Thanks in advance.

You should be able to do this in Grav with the site.yaml file using a wildcard alias for the routes. See

This is sort of in the realm of custom routing, which at the moment Grav does not support, but could be pretty cool to have in the future.

Thanks for the replies.


It would be great if that could be added. It’s useful in situations where a post title may change or the same title is used often. If routing supported more than 1 wildcard it could be as simple as something like this perhaps?

/post//: /post/


would route to


Please create an issue here:

I’ll mark it as a feature enhancement so it’s not forgotten!

Thanks boss! :slight_smile: