View Full Version : Creating a user subdomain with a wishname .. read more
suryoyena
06-01-2005, 12:17 AM
Hey people
I've got an idea, but dont know how to built that.
At the moment in vB you have a standard profile page for each user and you can reach it about the URL 'http://www.domain.com/member.php?u=1'.
My idea is that the user have the option to choose after their registration in the usercp a name and send it. This name would be a subdomain or alternative (if that's impossible with the subdomain) a new folder with a link to their profile page.
Example:
-- Choose the word 'johny' (This user have e.g. the uid 73)
-- The script creats the subdomain 'http://johny.domain.com'
-- 'http://johny.domain.com' will redirect you to 'http://.../member.php?u=73'
-- By the way: The name for the subdomain can be a different as the original vB-Username*
*Many user have in their nicks special characters like ? or ยง etc.
How you design later the profil page is your option. It's not important for this hack.
What do you mean to this request? Sounds it possible to do something like that?
I really don't know how it work with 'creating a subdomain' with a script.
The other option sounds more realisable: While choosing a name (johny), the script creates a folder named 'johny' with a htaccess-file, which redirects to the root-profile-page (member.php?u=73).
It would be very nice if it's possible too to see only the new url in the browser (and don't switch to 'http://.../member.php?u=73').
I hope my english is clear enough. If not, ask me please the unknowable parts.
Greets,
Chris :squareeyed:
oldfan
06-01-2005, 12:37 AM
Nice idea, I'd love the see this also :)
Marco van Herwaarden
06-01-2005, 07:02 AM
I think there is already a discussion about using mod_rewrite rules to achieve something like this.
suryoyena
06-01-2005, 01:18 PM
I think there is already a discussion about using mod_rewrite rules to achieve something like this.
Could you please tell us where we can find it?
A general question:
Is it even possible to write a script that creats a subdomain?
I searched for it but found nothing.
Chris
Greebo
06-01-2005, 01:41 PM
Wouldn't this have to be handled at the Apache level or even possibly higher up?
You're trying to mess with domain addresses - and the domain address tells one computer how to get to another computer. I'm no networking expert but I think what you're trying to do falls outside the boundaries of php on a webserver, because you generally can't just go to (whatever).address.com.
A URL is an address to a server. Typically if you change the prefix of an address, one of two things happens. Take "custom.vbulletin.com/org".
If you go to custom.vbulletin.com - you get redirected to www.vbulletin.com - not by php, but either by the dns on vbulletin's server, or by apache on vbulletin's server. One or the other has been set up to handle incoming requests to (unknown).vbulletin.com and redirect them to www. This isn't a php function - this happens before the browser ever gets to the pages.
If you try to go to custom.vbulletin.org on the other hand, you get a page cannot be found. Why? Because no redirect has been set up at a higher level to send ????.vbulletin.org to www. That redirect missing means the browser can't find the server or - if you found the server, the server didn't know what to do with you.
So I don't think what you can do is within the bounds of php *inside* the forums because the browser has to find the forum first. At a minimum dns and/or apache would have to know to pass (unknown).yourdomain.com to www and THEN you'ld have to examine the referrer url inside php and look up the right user.
suryoyena
06-01-2005, 01:53 PM
@ Greebo: I know what you mean, but I saw a website from Germany (uboot.com) and every user have a own 'webpage'. With his registration he gets automaticly a own subdomain. That's why I ask. I haven't found anything abouth somethink like this. I dont think that the admins creats for each user by himself a new subdomain, becaus it would be a fulltimejob.
Who knows sth.?
Andreas
06-01-2005, 02:00 PM
You don't have to "create" subdomains.
It's pretty easy to set up if you have access to the Apache and BIND Configuration.
Took me 4 minutes to get this working ;)
Setup a "wildcard domain" in BIND
*.yoursite.com IN A 123.123.123.123
Setup a vHost for *.yourdomain.com
Place a mod_rewrite or PHP (or Perl, Python, ...) script there to transform the hostname into smth. like http://www.yoursite.com/forum/member.php?username=...
And you're done.
deathemperor
06-01-2005, 02:06 PM
@ Greebo: I know what you mean, but I saw a website from Germany (uboot.com) and every user have a own 'webpage'. With his registration he gets automaticly a own subdomain. That's why I ask. I haven't found anything abouth somethink like this. I dont think that the admins creats for each user by himself a new subdomain, becaus it would be a fulltimejob.
Who knows sth.?
you're right, every user is user.domain.com <== this is not a real sub domain, it's just virtual and you can use mod_rewrite to achive it, don't ask me why I only know that but I don't really know how cuz my knowledge in .htaccess is limited. I really want something like this tho.
and, if you want to show the profile of a user with the name john with userid = 100, you can just use 'john' since vb3 allows you to access john profile through http://domain.com/member.php?usernam=john
If you need an example site for something like this: the best should be http://www.deviantart.com , myspace.com offers myspace.com/username which is also good.
If someone can do this, please make your actions.
suryoyena
06-01-2005, 02:20 PM
Hey Guys!
Thanks for the answers. I didn't know that. Okay:
-- deathemperor, thanks for this tip, but it's a community with many young people and I think it's only cool for them when they can say: "Hey visit my profile at chris.community.com" or else ;)
-- KirbyDE, thanks, but it's still to abstract for me, because I didn't worked yet in this field. You would help me much if you describe this a bit better.
Nice
Andreas
06-01-2005, 03:11 PM
Hmm, I don't know how I can describe this better :)
Do you have access to your DNS Configuration, either be directly editing BIND configuration or through a web frontend?
If you can't edit your DNS records in any way you're out of look, as this is absolutely necessary because otherwise nick.yourcommunity.com won't resolve to an IP address.
Furthermore you must be able to create a vHost for *.yourcommunity.com, again either by editing httpd.conf or through a web frontend.
When this is done, you can use smth. like
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.yourcommunity\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule (.*) http://www.yourcommunity.com/member.php?username=%1 [R,L]
Greebo
06-01-2005, 03:44 PM
Note that not all web front ends for DNS configurations will allow wildcards. I've just learned that mine doesn't, for example. :(
I actually am looking at doing some subdomain stuff myself, but w/o direct full control of DNS I either setup DNS server on my server and configure it myself or I just deal with creating unique subdomains manually. I don't expect to make that many subdoms so I'm not bothering with setting up DNS. :) I have enough headaches in my life. :)
Andreas
06-01-2005, 03:54 PM
Or use an external DNS Service that does allow wildcards (if you can modify your Domain-Record at your registy)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.