What will be the better way to implement wildcard sub-domains?
Vikas Chaudhary
Building BizeeBuy: B2B SaaS | Enabling Brands with eProcurement | Sourcing | Inventory | Payables Process
Hello Friends
I am looking into some better way to implement the wildcard sub-domains with PHP. There are a lot of ways and patches to do it but I'm looking for a way which can help me to achieve this by following the best practices. As I am not very much aware with the server side changes required for this, i can only configure the web server which enables the server to respond on every wildcard sub-domain. But the main problem is every sub domain itself might be an individual service or not can't say. If it is not a service then it will be fine but if it is a service then some services might have different behaviors or access controls. So I need such a way which supports both kind of situations and can provide a good scalability.
I do a little bit google on this and found some tweaks which are suggesting to play with .htaccess file if we are using Apache Web Server or do write some rewrite rules for NginX. Is this the only way we can do it, i don't know as I am doing such kind of thing first time in my career. Well, as I mentioned earlier I do not want to play with server configuration files and not want to write any rewrite rules for this, I just want achieve this this thing by PHP only or want to invest my maximum efforts on the language side instead of server tweaks.
Someone suggest me to use Laravel framework for this which provide domain based routing which can help to achieve this with less work on server OR Yii2 Framework also have similar functionality. You can write few lines of code which can identify the service name (the sub-domain) based on that the rest of business logic can be implemented.
My purpose of to share this thing here is to know only about the write approach to implement such functionality. There are a lot of web server with a lot of configuration options and functions and I want such a system which can easily communicate with the maximum of web server with less efforts done by the dev-ops or development team.
Thanks