You can setup a wildcard dns a record of * pointing to your server ip then anything.yourdns.com will work.
Should just be a case of looking at the cgi.http_host and parsing out the bit you want then redirecting question is whether you want a temporary redirect aka cflocation or a 301 ? A On Tuesday, 8 May 2012, Jason Allen <[email protected]> wrote: > I'm building an app and I'm curious about the best way to go about adding a function. Basically, I want to give users a subdomain they can use as a redirect. > > Currently, users will get a subfolder; aka company.com/username > I also want to give them username.company.com > I understand that I'll have to devise a way to update my dns records,but I also need for OpenBD to recognize the hostname as well. What's the best way of dynamically updating my OpenBD config to add the new hostnames to the hostheader list?Can I just set it up with a wildcard so I don't need to update anything? > Next, how would I be able to dynamically point that username.company.comto a > website that they declare? For subfolders ( company.com/username), I just parse out the 'username', look it up in a db, and forward users to the url in the database. > aka company.com/openBD could forward to groups.google.com/openbd > This works because the subfolder doesn't actually exist, and when the 404 error is thrown, I run a script to check if the folder is in the database. > However, with subdomains, they would just resolve to the site, not a specific folder, so I'm not sure how I could dynamically forward users to a URL (from a database) just based on subdomain alone. > Thoughts? > Basically, I want users to get 'username.company.com' and be able to point that to any url they want. > -Jason > > -- > online documentation: http://openbd.org/manual/ > google+ hints/tips: https://plus.google.com/115990347459711259462 > http://groups.google.com/group/openbd?hl=en > -- Alex Skinner Managing Director Pixl8 Interactive Tel: +448452600726 Email: [email protected] Web: pixl8.co.uk -- online documentation: http://openbd.org/manual/ google+ hints/tips: https://plus.google.com/115990347459711259462 http://groups.google.com/group/openbd?hl=en
