I have purchased a domain name which I have assigned an a name record to my Ubuntu web server. On the server each user has their own profile located at /var/www/user, each user has a sub directory. I need a sub domain for each user in the /user directory.
I started by giving the domain a wildcard '*' a name record which points to the server (as well as @ (obviously)). Then with a Virtual Host I use the wildcard to check for any requests to a sub domain and set their document root to a redirect directory /var/www/redirect. So essentially I'm filtering out sub domain requests and then sending them to the redirect directory to explode the sub domain they requested and forward appropriately.
My problem lies with trying to get the original sub domain they requested so I can explode the string and find the user they need and redirect. Does anyone know how I can do this? Should I pass it as a GET variable from Virtual Host or is there a better way?
If this sounds like a bad design I'd highly appreciate it if you could suggest a better one!