I have this permalink structure in wordpress /%category%/%postname%/
now suppose i have written a article article with title "Hello World" and i selected two categories for this article "cat1" and "cat2" now "cat1" is my primary category and i selected this using RankMath Plugin
just because "cat1" is my primary category for that post the url become
https://example.com/cat1/hello-world/ when we go to this the post "Hello World" is loaded.
but when I manually go to the same post with "cat2" https://example.com/cat2/hello-world/ the same article "Hello World" is loaded.
Now https://example.com/cat1/hello-world/ & https://example.com/cat2/hello-world/ both urls are working individually and this is a problem
this url with secondary category https://example.com/cat2/hello-world/ should get 404 or automaticllay redirect to primary category url https://example.com/cat1/hello-world/
but the problem is if same post is working with "cat2" also
this way i have two url for same article, how to fix this? Please Help.