Can a username redirect to a subdomain?
September 2, 2006 9:02 AM
Subscribe
How would I setup a password-protected subdomain where the username is the subdomain? My levels of incompetence will be further explained, as there is
I would like to have a series of subdomains setup for password protection, with the username also being the name of the subdomain.
How can I setup a single login screen that takes a given input of username/password and (if a valid username/password combination) redirects to the address http://username.domain.com/?
For what it's worth, I will be using a LAMP-style server and have the ability (but not necessarily the skill) to write .htaccess files.
posted by jmevius to computers & internet (3 comments total)
- access to the DNS server for your domain, so that you can set up all the various valid hostnames (www.example.com, jack.example.com, jill.example.com, etc.) to point to your server;
- access to the webserver config on your box, so you can have the webserver respond to any given *.example.com hostname (or specifically, the example.com hostnames that you wish to be valid);
- a way to define which usernames and passwords are valid which can be accessed programmatically (e.g., an array in your page that serves the login script, a database that your page can query, whatever).
Then, it just takes writing the login page, which should have a form for the username and password, and on submission, should check those for validity and then do the direction. If you say you're using LAMP, then this is trivial to do in PHP.
posted by delfuego at 11:03 AM on September 2, 2006