I'm a fairly avid programmer, but recently moved to web development, so I apologize if this question is somewhat silly.
I'm building an e-commerce webApp that should support multiple domains. Lets say I have 2 stores running in my App, each one having its own custom domain.
The app is located at: www.main-app.com
The store 1 is located at: www.store1.com
the store 2 is located at: www.store2.com
I need to redirect all requests made in store1.com
and store2.com
to the main-app.com
passing an id, which is the store Id. the store Id is used to load all components of each store.
I've managed to add CNAME records to store1 and store2 pointing to www.main-app.com
. So far so good, when I type www.store1.com
in my browser, the main-app shows on screen, but how can I pass the store Id so it knows which store to load?
Which would be the best approach to make this feature possible?
In essence, I want to type www.store1.com
and www.main-app.com
receives a request to load store1. I don't want to use domain forwarding, like typing www.store1.com
and it redirects the user to something like www.main-app.com?storeId=1
.
I hope I made myself clear.