Custom Domain mapping in cloud based application

438 views Asked by At

I am creating a cloud based application in laravel/php.

I have a functionality where user can have their website at user.myapp.com and it works (with subdomain and model binding).

I now want to go one step further, and allow users to add their own custom domain names. So their website will be reachable at user-domain.com rather than (or as well as) user.myapp.com.

I want to understand how to do this. I'm using Laravel framework which is based on php and apache.

What kind of server do I need? Can I use shared hosting? What configs do I need to do in order for this to work? What DNS record the user must create to put things together?

1

There are 1 answers

4
Jerodev On

You can do this with any kind of server. You can make a route that is caught by any domain and in the controller of this route, you can query the database to know what website should be displayed for that domain.

You can get the domain name of the current request using app('request')->root();