Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

engrlaravel's avatar

dynamically create subdomain

I have SAAS software. When companies register on my website, i want to give them sub-domain at the same time. Example abc company registered now, the system will automatically redirect him to http://abc.example.com where can can be able to view all my services/features.

Is it possible in laravel? how i can do it?

0 likes
4 replies
MThomas's avatar

Sounds like a Multi tenant approach might help you. This will also enable you to isolate all tenant/company data in seperate databases or tables.

Take a look at https://laravel-tenancy.com/ or https://github.com/orchestral/tenanti for composer packages doing the heavy lifting.

If you like to do it yourself take a look at these two great blog posts:

engrlaravel's avatar

@mthomas @fraserk : How it can be done dynamically? On successfully signup, you will be redirected to your own sub-domain. is it possible with above approaches?

MThomas's avatar

I guess, the best way to find out is to give it a try.

But as you need to record the subdomain somewhere there is no reason you could not redirect there (its nothing more than a regular redirect).

Please or to participate in this conversation.