Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vanity Subdomain for SaaS Web app instances

Status
Not open for further replies.

TGrahmann

Programmer
Feb 19, 2015
43
US
Hey, Guys (not sure if this is the correct board to post this in, but I'll let you decide that), I'm wanting to produce a web app with vanity subdomains for different user's sessions. Similar to how zendesk works. i.e. YourCompany.MyApp.com, would somehow reference that user's databases for their session of the app. Is there a simple way to do this, or is it better just to stick with one big instance for the totality of the users?
 
Its probably simple, but has nothing to do with PHP.

Subdomains are the sole control of the webserver not PHP. You would need use a server job/script outside of PHP, that generates such subdomains in the webserver's configuration file and points them to whatever it is you want to point them to and restarts the webserver to apply the changes everytime someone signs up to your app.

Alternatively, you can have your actual domain respond to all subdomains by editing the , and then have PHP serve the appropriate content based on what subdomain was requested.
See here:









----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Sessions are per user anyway, any request is that of a single user in $_SESSION and has only that users session data and LocalStore and whatever you use clientside.

TGraham said:
one big instance for the totality of the users?

Not sure what you're talking about. You can have several web apps on the same domain subdomains are one way to separate that, but not necessary. You're in full control where you ask for separate logins and even if the same user should be able to use several web apps, it's up to you how many sessions you start, the session management regarding PHPs $_SESSION, see session_id() and /or session_name().

The role of browsers is to store cookies per domain/subdomain, but you can have separation without using subdomains, you can store session info server side or client side, just look a bit deeper into PHPs session functions what you can do. You're not forced to use session_start(); parameterless and have only one session for the user for the whole site. It's really up to you.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top