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.

How Redirect Domain To Sub-directory?

Discussion in 'General Discussion' started by netmation, Sep 24, 2004.

  1. netmation

    netmation Member

    Joined:
    Sep 23, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Within CPanel, how can you redirect or park an extra domain name to a sub-directory or another "added domain" within the main account.

    Or must you ADDON that DOMAIN? Seems the REDIRECT feature in Cpanel works backwards from what I am looking for (it does directory --> extra domain, instead of extra domain --> directory)?
     
  2. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    To create subdomain mine.mydomain.com, go to subdomain maintenance and create the domain by inserting the name of the domain - mine here -in the first box. The new folder mine is then where you would put the new index file (startup file.)

    Does that answer this?
     
  3. netmation

    netmation Member

    Joined:
    Sep 23, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Lloyd, thanks for the note but not exactly what I was asking, let me see if I can be more clear. Let's say I have a main account setup in Cpanel for mydomain.com. I now want to point a new domain, called newdomain.com to mydomain.com/newstuff (which could also be newstuff.mycomain.com). There is no re-direction capability within Cpanel to do this, is that correct?
     
  4. netmation

    netmation Member

    Joined:
    Sep 23, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    After reading your reply I see my confusion now. You are correct that would work for a new domain and is what I was asking. But what I meant was how can you now park a 2nd or 3rd domain name to that new sub-domain. Parking domains only seems to work for the primary account domain. Sorry for my confusion, and poor explanation of my question.
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    As you said at the start, you if you want to point an additional domain to a subdirectory of your site you should use the Manage Addon Domains facility in cPanel, if enabled.
     
  6. netmation

    netmation Member

    Joined:
    Sep 23, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Jonathan,

    Did not know there was a "Manage Addon Domains" feature, that must be my problem why I couldn't setup the proper re-direction.

    Thanks, Al
     
  7. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    Uh, chripy - what Manage Addon Domains are you talking about? I am on stable, Pro and have no info or no idea where it is/would be. I looked at X and it is not there.
     
  8. netmation

    netmation Member

    Joined:
    Sep 23, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    I was told there is no "Manage Addon Domains" also. Not sure what he is referencing? Don't think it is possible to redirect or park additional domain names to a sub-directory? Am I correct?
     
  9. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    You can always do it through DNS zones. That will definitely work.
     
  10. tprice42

    tprice42 Active Member

    Joined:
    Sep 10, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Some hosts (like us) don't allow the usage of the Addon Domains feature because it's generally used for dis-honest purposes.

    Say you've got a hosting account with 600+MB of space and access to addon domains, you can then resell those services for massive profit by hosting other people's websites in sub-directories of your own account.

    This may explain the absence of this feature in some people's cpanel interface.
     
  11. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Indeed. I didn't make the feautre up ;) If you can't see it, your hosting provider has disabled it. If you're the hosting provider, it is right there under WHM > Feature Manager > <list> > Addon Domain Manager
     
  12. ladierainy

    ladierainy Well-Known Member

    Joined:
    Dec 1, 2003
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    When you say - park a domain name to a subdirectory - does this mean a real domain name as in www.mydomain.com?

    I'm trying to figure out how to sell subdomains off one of my sites (I *am* the host so I'm fine with this obviously, LOL), the site name would be an asset to those that would want the name.

    I don't want the typical url for them - stacyfrak.mydomain.com, I'd like to have the url read as my domain name first, then their name: mydomain.com/stacyfrak

    So I know I can give them limited ftp for only their directory, but I also wanted to give them a limited cpanel (I've created a much smaller cpanel option in the Feature Manager).

    So far all the formats I've checked into for subdomains wind up with the end result of the subdomain name first, then followed with the url (subdomainname.mydomain.com), and I would MUCH prefer the directory format (mydomain.com/directory) or the other one I've seen: mydomain.com/~subdomainname.

    I've made the domain I'd be doing this from as a reseller thinking that might help, no go as of yet. I've combed trough my WebHost manager (and I'm pretty sure I've enabled everything I'd need for myself - again I am the host, so I ought to have full ability to do all this stuff - just not sure what I'm doing wrong, or what I'm missing here.

    I do host full domains, but I'd like to have this one site offer limited subdomain hosting - so can anyone help me with this, or direct me to some documentation that will give me step by step instructions, or a post or a link that might answer this for me? I've been looking all over the web to no avail for 2 days, I'd LOVE a lifeline here! LOL!

    Thanks SO much for reading this, your time, and any help you could give me! :D
     
  13. bpmod

    bpmod Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Hello ladierainy

    That's simple once you know what to look for (and how these things are worded).

    Just set up your subdomain stacyfrak.mydomain.com, which creates the subdirectory stacyfrak. Then once that is set up, set up a redirect that points stacyfrak.mydomain.com to http://mydomain.com/stacyfrak.

    Then anybody entering the subdomain into the browser will get redirected to the way you want it (with your domain first).
     
  14. ladierainy

    ladierainy Well-Known Member

    Joined:
    Dec 1, 2003
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    Ohhh I see thats simple!!

    Now how would the cpanel then work?

    Would they need to type in staceyfrak.mydomain.com/cpanel or mydomain.com/staceyfrak/cpanel?

    Also when making a subdomain, should one use the subdomain fnction in cpanel or the addon domain feature?

    To be honest I'm a tad puzzled about parked and addon domains - though I think parked domains is just having the name on the server but not an active site, maybe used as a mirror site.

    When I try to use the addon function it adds it and them removes it, saying its not a valid domain name, or that's its an invalid function - but I have enabled that via the webhost manager panel.

    Could you possibly give me a quick idea on the differences and when it is best to use one over the other and how one would determine that? Is there a place I could have found this answer somewhere without bugging you folks? lol

    Thanks so much for your help so far!! :D
     
  15. bpmod

    bpmod Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    The system will not let you use a sub-domain as an addon domain or a parked domain. That is, if you are adding sub.domain.com to domain.com, it will only allow you to add it as a sub-domain. If you try adding it either of the other two ways, it will give you an error.

    In general, if you wish to use sub.domain.com or domain.com/sub, add it as a sub-domain; if you want to use a separate domain in the same account with completely different content, add it as an addon domain; and if you have two domains for which you wish to use the same (or very similar) content, add the second as a parked/pointed domain.

    Both sub-domains and addon domains use a subdirectory. Parked/pointed domains use the main directory. Also, addon domains also create a sub domain based on the directory you have chosen for the content of the addon. For example if you have domain.com and you add domain2.com to the directory sub, it will be accessible as sub.domain.com or domain.com/sub or just domain2.com

    In answer to your question about cPanel access for subdomains, I don't know for sure, but I believe that that is not possible. Somebody correct me if it is.

    However, you can add ftp access for just a sub- or addon domain by granting access to the subdirectory. (One is set up automatically with an addon domain, but you have to set it up in the case of a sub-domain)

    Hope this helps :)
     
  16. abhi

    abhi Registered

    Joined:
    Oct 31, 2004
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I have exactly such a setup.

    But I have noticed one problem with that. If user tries to access domain2.com/somedir, he will automatically be redirected to sub.domain.com/somedir/. I obviously don't like this. Can this be fixed?

    Then I noticed that if user adds a slash at the end of url, then he will not be redirected.

    OK, then I wrote a few lines at the beginning of each index.php in every directory to check if user is redirected to subdomain and if he is, then I redirect him once more.

    if ( strstr($HTTP_HOST,'.domain.com'))
    {
    header("Location: http://www.domain2.com$REQUEST_URI");
    }


    But now I have a third addon domain pointing to the same directory as domain2.com. I need this because of multilanguage support on my site. One domain shows page in my language and another one in english.

    It seems that there is no way to detect, if user, who has been redirected because of not adding slash at the end of url, wanted to go to domain2.com/somedir or to domain3.com/somedir. So, I can redirect *ALL* of them to domain2.com$REQUEST_URI or to domain3.com$REQUEST_URI

    And this is not good of course.

    Any suggestions please?
     
Loading...

Share This Page