2👍
✅
You could use a catch-all URL, e.g. put url(r"^(.*)$"
as your last entry in urls.py
and then use some string similarity measure to find a likely url. See this question for examples. Or this one for more of them.
Or perhaps just a simple startswith()
loop over known urls will do?
Your view probably should return a response with a redirect (result code 302
or 303
) if there is a single match – and if there are none (or multiple) a 404
page with list of possible matches is the way to go.
Source:stackexchange.com