SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    eCommerce specialist hotnuts21's Avatar
    Join Date
    Apr 2002
    Location
    Aberystwyth, UK
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    set up sub domains on the fly

    I was wondering is it possible to set up sub domains on the fly? I am building a site and basically a user can sign up for free and choose the name of his site, when he/she clicks submit I want it to set up there website under the sub domain www.sub.mysite.com

    Is this possible ?
    • Search & Rescue Aberystwyth Lifeboat
    • CSS Tutorials/Guides

    Sitepoint signatures are not visible to Search Engines More info

  2. #2
    ko pročita magarac :) boccio's Avatar
    Join Date
    Oct 2003
    Location
    belgrade
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just a thought: why don't you use url-rewriting to point it to the user΄s home dir?
    Vivvo CMS - Web publishing at your fingertips
    Mile voli disko, a ja belo kolumbijsko

  3. #3
    eCommerce specialist hotnuts21's Avatar
    Join Date
    Apr 2002
    Location
    Aberystwyth, UK
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well im not 100% sure what you mean, so I will explain more what I am doing and you can tell me if it will still work.

    Basically the site will be powered by one database. There will be a main website page www.station.com and then each station around the country will be able to sign up www.london.station.com will be the sub domain. The people at that station will have there own littel site which will report all the shouts and activities that go on at that station. There will be approx 200 station websites. Each having a mini content management system where they can update there own little sites news/etc content.

    All the sites will work from one database, so the main site will show the latest news etc from all the smaller sites

    As well as the sub domain being automatically generated, it would be ideal that a few files are automatically copied to the new subdomain site so its ready to go. But this is probably really difficult so for now, just the sub domain set up will do
    • Search & Rescue Aberystwyth Lifeboat
    • CSS Tutorials/Guides

    Sitepoint signatures are not visible to Search Engines More info

  4. #4
    ko pročita magarac :) boccio's Avatar
    Join Date
    Oct 2003
    Location
    belgrade
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm...
    Since all the sites will work from one database (assumption: one server) you might as well host all their subdomains on your main server (site). That way you can create a foder for 'London' (ie. /home/station/london/) and have mod_rewrite map it as london.station.com...

    On the other hand, you can try your luck with exec() if you know command-line parameters to create subdomains on server...
    Vivvo CMS - Web publishing at your fingertips
    Mile voli disko, a ja belo kolumbijsko

  5. #5
    eCommerce specialist hotnuts21's Avatar
    Join Date
    Apr 2002
    Location
    Aberystwyth, UK
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On the other hand, you can try your luck with exec() if you know command-line parameters to create subdomains on server...
    nooooooooo

    So instead of having to create 200 folders some of which might and might not be used, is it possible to automatically generate the file AND use the mod_rewrite map to it?
    • Search & Rescue Aberystwyth Lifeboat
    • CSS Tutorials/Guides

    Sitepoint signatures are not visible to Search Engines More info

  6. #6
    SitePoint Addict shad0w's Avatar
    Join Date
    Aug 2003
    Location
    PA
    Posts
    239
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well creating lots of subdomains would seem to be more work than it has to be. I say when the user signs up and chooses a subdomain, have a folder created for that user and then write to a .htaccess file and add a mod_rewrite snippet. I would make sure that whatever info is written to the .htaccess file is heavily filtered because writing to that file can be very dangerous.

    EDIT: Actually it is possible using sockets through php, atleast on my server. Read this: http://www.dr2.net/vB/showthread.php...ight=subdomain
    Last edited by shad0w; Oct 12, 2003 at 15:16.

  7. #7
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Use modrewrite.

    Store the data in a database.

    No need to use folders or "real" subdomains.
    Mike
    It's not who I am underneath, but what I do that defines me.

  8. #8
    SitePoint Addict shad0w's Avatar
    Join Date
    Aug 2003
    Location
    PA
    Posts
    239
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but writing to a .htaccess file is very, very dangerous.

  9. #9
    eCommerce specialist hotnuts21's Avatar
    Join Date
    Apr 2002
    Location
    Aberystwyth, UK
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You tried it on your server?
    • Search & Rescue Aberystwyth Lifeboat
    • CSS Tutorials/Guides

    Sitepoint signatures are not visible to Search Engines More info

  10. #10
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by shad0w
    Yes, but writing to a .htaccess file is very, very dangerous.

    Don't write to one then

    Set it up so it detects the subdomain, uses that as the member id variable (or whatever), then the uri could be pass on as the page called.

    site1.station.com/contact/
    goes to
    http://www.station.com/members.php?i...1&page=contact

    All this would be an internal redirect, so the end user would never see the redirected URI.

    Paul, I'm not 100% on the code to do it, but Pippo has posted about 20 different soilutions for this in the Cinfigure Your Server forum. Do a search in there, or post and wait for him to get back from vacation.
    Mike
    It's not who I am underneath, but what I do that defines me.

  11. #11
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'll need wildcard DNS enabled on your server if you go the mod_rewrite method BTW

  12. #12
    eCommerce specialist hotnuts21's Avatar
    Join Date
    Apr 2002
    Location
    Aberystwyth, UK
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool thanks guys, that sub domain create script works a treat and I can give all the users there own ftp if I go down the proper subdomain route

    You can see the script here
    http://scripts.l33t-2k.net/

    Only problem is that it doesnt give the subdomain with www at the start!

    Only thing next is to write all the relevant CMS files to the users account once it has been created, so they can access it straight away
    • Search & Rescue Aberystwyth Lifeboat
    • CSS Tutorials/Guides

    Sitepoint signatures are not visible to Search Engines More info

  13. #13
    eCommerce specialist hotnuts21's Avatar
    Join Date
    Apr 2002
    Location
    Aberystwyth, UK
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got an email telling me tmapm had just replied to this topic, but I cant see it can anyone else?
    • Search & Rescue Aberystwyth Lifeboat
    • CSS Tutorials/Guides

    Sitepoint signatures are not visible to Search Engines More info


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •