FIX: Redirect user to the URL with the correct category slug (PR #10167)

We have a similar redirect in place for topic URLs with wrong slug. The difference between topic and category routes is that the former have just one parameter (the post number), while the latter have a lot more (filter, order, page, etc). This is the reason why I decided to use the request URL and swap the “wrong slug” with the actual one. The other solution was to reconstruct the URL which was error-prone and a lot more complex.

GitHub

Shouldn’t this slug generation be done in the category model?

PRO TIP: You can return redirect_to on the same line :wink: