The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting subdomains to go to subfolder

Discussion in 'General Discussion' started by cragdo, Jun 20, 2005.

  1. cragdo

    cragdo Member

    Joined:
    Jun 29, 2004
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Hey everyone,

    I have a quick question. I use a script i found on here to create a subdomain for some users. The thing is, my public_html folder is getting over crowded with subfolders.

    Is there a way to make it so that when I create a subdomain it would go to something like:

    http://mysite.com/users/bob (where bob would be the username) instead of how it is now http://mysite.com/bob

    That would be great.

    Thanks for any help you can give. I can get WHM access if needed.
     
  2. cragdo

    cragdo Member

    Joined:
    Jun 29, 2004
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Currently im using this
    PHP:
    $output fopen ("http://$login:$pass@www.$domain:2082/frontend/x/subdomain/doadddomain.html?domain=$subdomain&rootdomain=$domain""r");
    $output fopen ("http://$login:$pass@www.$domain:2082/frontend/x/ftp/doaddftp.html?login=$subdomain&password=$ftppass&homedir=$subdomain""r");

    would i just change homedir=$subdomain to something like
    /users/$subdomain

    ???

    Any help would be very helpful thanks.
     
  3. davemehta

    davemehta Member

    Joined:
    Jul 13, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    This is actually a quite simple and genius way of using a php script to simply access the methods of Cpanel to get the task of creating subdomains done automatically!

    I simply want to create a subdomain for my new accounts that's called admin. So when they go to admin.theirSite.com they can easily log in to their cpanels.

    Question: I want to now add redirection info to the subdomain, but this isn't working...

    $subdomain = "admin";
    $output = fopen ("http://$login:$pass@www.$domain:2082/frontend/x/subdomain/saveredirect.html?domain=$subdomain_$domain&url=http%3A%2F%2F$domain:2082", "r");

    Why wouldn't this work, when the creating a subdomain worked?
     
  4. cragdo

    cragdo Member

    Joined:
    Jun 29, 2004
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    If you search for automatic sub domain, I think you will find the answer. Some posts I read have the same question you just asked. :)
     
  5. davemehta

    davemehta Member

    Joined:
    Jul 13, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    It actually does work... I found that it wsa just buggy tho.

    What I want to do... with the first bit of code is create a new account. Then with the redirect code create the subdomains and tell them to redirect to the appropriate places.

    It seems this isn't fully working tho. It works sometimes and not others, and ideas why?

    Please see my last post here... http://forums.cpanel.net/showthread.php?t=24328. That explains exactly what I am trying to do.
     
Loading...

Share This Page