How would I configure index.php to change the store view based on the link clicked?

I am trying to setup a multistore in magento 2. Here is how I need to set it up. The main website and store view is essentially just a landing page that branches to the two stores. So in magento i’ve set up two additional websites and store views for my two actual stores. I connected those stores to different root categories. Then in the configuration settings I set the base url of each view to a unique url ie example.com/store1. I set a custom theme and home page for each view. I use the full url link to link to each store view in the frontend.

Here, I run into some issues. While the links work, it looks like the actual store view is not changing. The theme and catalog navigation remains the same as the main website. How would I configure index.php to change the store view based on the link clicked? Is this even possible or is there a better method that would yield the results I need?

By the way I have tried the method of using subdomains ie store1.example.com. When I do that, the url switches but it retains the same home page, theme and catalog as the base website. So if this is the best method, I am not sure what I am doing wrong there. I would really appreciate help straightening this out.