Flarum uses the disscusion ID to generate the url. If the title is incorrect the forum generates the correct title for the url (slug). Example: https://discuss.flarum.org/d/4010-lorem-ipsum-dolor
(incorrect) -> changed automatically to -> https://discuss.flarum.org/d/4010-flarum-v0-1-0-beta-6-released
(correct).
You are creating a redirection (great!), but the http status code is not correct. https://discuss.flarum.org/d/4010-lorem-ipsum-dolor
show a 200 (ok) status code. The correct status is 301 (moved permanently).
Edit. Reported on GitHub: flarum/core1140