simonw / museums

A website recommending niche museums to visit

Home Page:https://www.niche-museums.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shorter URLs for museum pages

simonw opened this issue · comments

Right now they are:

https://www.niche-museums.com/browse/museums/102

I'd like to shorten these to just:

https://www.niche-museums.com/102

Using the new custom template page parameters feature in Datasette 0.49.

One trick: I need to ensure I have 301 redirects from the old locations.

I'm redirecting the old URLs here:

def redirect_museum(request):
return Response.redirect("/{}".format(request.url_vars["id"]), status=301)
@hookimpl
def register_routes():
return [
(r"^/browse/museums/(?P<id>\d+)$", redirect_museum),
]