Using slug only as url without id

AI-generated summary

A user, caiiiycuk, is experiencing an issue where visiting a topic URL without an ID (using slug only) redirects to the welcome topic, but works normally when clicked from another topic. Falco explains that this is the intended behavior, as Discourse treats URLs starting with a number as IDs. pfaffman advises against using slug-only URLs, as they can break if the topic is renamed and are more work to use than URLs with IDs.

Hi. I use slug only urls, like:
https://talks.dos.zone/t/007-james-bond-the-stealth-affair-1990-fr/
But if I open it directly in browser it redirects to welcome topic. When I click same url into another topic it works normally.
Example (click on French link):
https://talks.dos.zone/t/007-james-bond-the-stealth-affair-browser-and-mobile-versions/44659

Is it intended behavior?

This is working as intended.

Discourse support the 3 types:

But if the slug starts with a number we special case and look for the first number as an ID:

Ahh ok. So it will affect little amount of urls. Thank you!

That’s more work than using the url in your browser (that has the ID) and will break if you rename the topic. (plus when the title starts with a number)