Store switcher rediecting to homepage in Magento 2.4.3

The store switcher redirects me to the hompage everytime I switch from for example a product or a CMS page.

Example:

www.example.com/en/something.html --> switching the store view to www.example.com/es/something.html

This redirects to the home page. I checked the net and it seems to have been a problem with earlier versions, but I found nothing for 2.4.3?

Ideas?