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.

Point AddOn Domains to same folder?

Discussion in 'General Discussion' started by hostb, Jul 18, 2009.

  1. hostb

    hostb Member

    Joined:
    Jul 14, 2009
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I'd like to automatically point all my new domain registrations to a single webpage eg,
    "Home of Domain.com
    Hosted by Hosting Company"

    I was going to create an addon domain for each new domain using the API's and point all the domains to the same folder with the default index page.

    However you cannot point more than one domain to a location.

    Any suggestions? A skeleton directory for all add on domains or something?
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    An "Add-On" domain would be a very stupid move for what you are asking for namely because that not creates a lot more work for you every time you get a new domain but also has absolutely nothing to do with what you are asking for!

    In the manner you are asking, PARKED domains would be more appropriate but even then I wouldn't use those as you'll see further below.

    Where in the world did you get that idea from?

    What you are describing is called "PARKED" domains! ;)

    "ADD-ON" domains have their own folder and separate FTP login but "PARKED" domains are aliases for the same address. In other words, parked domains give you an extra domain to get to the same web site!

    Now with that said, I would use neither of these as you'll see in your next question.
    A skeleton directory would be part of what you should do in that you should drop in a default "index" page with a redirect to your default page as it makes less files for a client or you to have to delete later when building new web sites.

    Incidentally, unless you are a reseller, your skeleton folder is located at /root/cpanel3-skel/

    In example, you could drop in an index.php file into the skeleton such as:
    Code:
    <?php  header("Location:  http://1.1.1.1"); ?>
    
    (Where 1.1.1.1 would be your main server's shared IP address)

    Placed in the /public_html of the skeleton folder, this index.php would automatically be copied upon new web hosting account creation.

    The next thing I would do is replace the files of your DEFAULT web site which is the web site that is displayed automatically when someone connects to your server by IP address or in the case of domains pointing to the server which have not yet been setup as an account on the server and normally displays the default cpanel page if it hasn't been updated.

    That site is located in: /usr/local/apache/htdocs

    This is where you would put your "Hosted by Hosting" whatever pages and would show up for any domains that point to your server where you have not yet setup any hosting account for those domains.

    For those where you do setup an account, they would still display that same page because of the skeleton index.php file until new web files were uploaded for the new web site replacing that redirect.
     
    #2 Spiral, Jul 18, 2009
    Last edited: Jul 18, 2009
  3. hostb

    hostb Member

    Joined:
    Jul 14, 2009
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Thanks for the reply.
    I suggested addon domains because,
    1.) I wanted the domains url to remain in the browser address bar for my 'parked' pages. This would not happen using parked domains.

    2.)But most importantly for the local domains I sell, they must resolve correctly to a nameserver for the domains regulator to approve the domain. So in a way they always need some sort of 'hosting'

    So I must put them on my nameservers somehow.

    The only way to get the domains onto my nameserver automatically is add
    them with the cpanel API's as either new, parked or addon

    My /root/cpanel3-skel/ directly contains a default page for full hosting accounts. So I can't change that.

    I hope my question sounds a little less stupid now.
     
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    That's Wrong! ;)

    With parked domains, the domain you used to reach the site remains in the URL address bar!

    I have many servers with hundreds of parked domains and I can tell you first hand that the parked domains stay in the url bar and you can even navigate to different web pages in the site and the parked domain STILL stays up the URL bar showing as the site you are connected to the entire time!

    I can give you hundreds of examples and in each and every one, the domains -- just mere parked domains --- appear
    to be the main domain and you are totally and completely unaware they are "parked" domains.

    The only time you would get the domain in the URL change is if you used a redirect or a hyperlink to a different domain name but a "parked" domain is NOT a redirect and the domain shown in the address bar *IS* the "parked" domain you typed to originally get to the web site and does not change! Apparently, you somehow got the notion that a parked page is a redirect and gets updated to the main domain when you connect, but that is completely incorrect!

    A parked domain is fully a secondary name for the "web account" on the server. It is NOT a redirect to the main address!

    (Incidentally redirects can be generated by Apache such as web file redirects or .htaccess redirect commands (OR) by DNS such as using a CNAME record instead of an A record. Parked domains uses "ServerAlias" which is different and the web server cannot distinguish the parked domain from the main domain as they are equals and the server answers to both domains and delivers the content found at DocumentRoot for the account)

    Code:
    <VirtualHost x.x.x.x:80>
        ServerName mydomain.com
        ServerAlias www.mydomain.com parkeddomain.com www.parkeddomain.com
        DocumentRoot /home/login/public_html
    
    Again you are wrong! ;)

    You do not need to setup any hosting account at all!

    Most registrars do not require DNS to be setup in advance of hosting but for those few that do (and some countries), you still do NOT need to setup a hosting account but rather just simply the DNS zone file for the domain and nothing more. Drop in a simple zone file pointing to your default shared IP and everything I said before will work just fine and the registrar will be able to resolve the zone for the domain at your DNS servers. So I must put them on my nameservers somehow.

    Once again you are wrong!

    Setting up "parked" or "addon" domains or hosting accounts is NOTthe ONLY way to get domains in to your nameserver.

    There is also "Add a DNS Zone" listed under "DNS Functions" that generates the exact same zone files as creating any of the above but is actually even simpler because you don't have to specify a username or password or anything. Just type the name of the domain and that's it!

    Like "parked" and "add-on" domains, adding DNS zones can also be done through the cPanel API functions automatically as well just the same!

    That's the whole point. You were updating the page for the "hosting accounts" you were creating!

    However, for what you are talking about with adding new domains, you really
    don't even need to do any of that as you already would have a page setup for the domains before hand and don't even need to setup any hosting account for the new domains in the first place, not until you are actually ready to host the domains and then you can deploy your "full hosting account" skeleton at that time or whatever you want to do!

    Setting up the redirect page in the skeleton was just a little extra icing to have redirects AFTER the hosting account was created but is totally optional and completely unnecessary in your case since you already have the page setup for the new domains already anyway from the default IP address page I told you about previously.

    Actually just the opposite as it makes it more clear you don't have a full grasp on what you can and can't do with Cpanel or how thing operate although that is something we can hopefully help you remedy around here! ;)
     
    #4 Spiral, Jul 19, 2009
    Last edited: Jul 19, 2009
  5. hostb

    hostb Member

    Joined:
    Jul 14, 2009
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for so much detail. I am always amazed at the time some of you people put into helping the newbies out.

    I wanted to park domains but have them 'redirect' to say /public_html/parked_domains/index.html. But I guess that is an addon domain. And that is why I always get the URL change. Because I effectively do a redirect.
    So if I understand correctly a parked domains will always work as an alias to only the root directory of the web page. Man I think I'm answering my own questions here, sorry.

    But I think you came up with the solution for me. I could use a spare IP that still will show /usr/local/apache/htdocs.

    I can then add all domains (ordered without hosting) as a DNS zone using that IP. And as you say I can still use the API's to automate the process.

    Also that way the URL won't change.

    So you think that is a good solution?

    EDIT: Is there a problem deleting a domain added as a DNS zone in WHM. I just tested it. The DNS deletion didn't work in WHM. And now when I try to park the domain again in cPanel it just ignored cPanel park and the WHM end over rides it as if the DNS zone is still in WHM.
     
    #5 hostb, Jul 19, 2009
    Last edited: Jul 19, 2009
  6. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    I'm a hopeless posting addict :D

    Parked domains = Alternate additional web address for the same site

    Addon Domain = Additional domain added to the account that is setup
    to operate as it's own separate web site under a subfolder of the
    main hosting account and has it's own FTP login.

    Neither Add-on domains nor Parked domains are redirects. The difference
    is whether you want to the domain to have it's own separate web site
    or bring up the same web site as something else that already exists.

    Now one thing you may not have considered but what you just mentioned
    in having thing setup under /public_html/parked_domains is that you could
    setup the first domain as an "Add-On" domain pointing to that folder and
    then all subsequent domains as "Parked" domains laid on top the first and
    utilize both, that way none of the domains are redirects and all of them
    are pointing to the same subfolder. Just an example of how to do what
    you just mentioned folder wise above.

    True, you could use any IP on the system. The advantage of using something other than the main shared IP is that you could still have the main cPanel default page plus your own default page for the other IP.

    The best way to set that up is to setup one account with a dedicated IP and then make it a reseller and setup the IP to be the main shared IP for the reseller. By doing that, the system will allow you to use the secondary IP as another shared IP and you can have multiple hosting accounts with the same IP and as many domains as you wish on the IP.

    Yes and yes ..... Setup DNS Only ...... Use the API for full automation.

    That's definitely the easiest. Any other way would cause more work in other areas and unnecessary extra steps you would have to deal with.

    No, there is no problem deleting DNS zones in WHM or the API. I have never myself had any problem deleting domains and re-adding them as a full hosting account although I have fixed occasional glitches with that in other people's cPanel servers and they are generally quite rare.

    However, if you should run into such an issue (mostly doing something wrong in those cases more often), you can go into /var/named and manually delete the zone file (domain.com.db) and edit /etc/named.conf and remove the section for that particular domain zone and then you should be able to add the domain without any further problems.

    PS: Speaking of "doing everything", did you restart your named (DNS) server after deleting the zone?
     
    #6 Spiral, Jul 19, 2009
    Last edited: Jul 19, 2009
  7. hostb

    hostb Member

    Joined:
    Jul 14, 2009
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    You have been a great help. Thank you very much for all the time and effort. I'm glad I asked here first now.
     
  8. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    No problem. Glad to give you a hand. :D
     
  9. richardwing

    richardwing Member

    Joined:
    Sep 18, 2002
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    AZ
    Spiral...

    I have a similar request..

    However I know I want to use parked domains.

    The difference is I want the parked domain to not park in the main domains public_html folder I want a given parked domain to resolve in a subfolder of that domain.

    Is there a way with htaccess or a php script once I park the domain to have htaccess or script then have the domain use a subfolder as its root folder?

    maindomain.com/parked1

    maindomain.com/parked2

    maindomain.com/parked3

    parked domain 1 will resolve in this folder maindomain.com/parked1

    parked domain 2 will resolve in this folder maindomain.com/parked2

    parked domain 3 will resolve in this folder maindomain.com/parked3

    or maybe there is a way through whm to set these up that you know of?

    Thanks for any assistance you can offer.

    Richard Wing
     
  10. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    Hello Richard,

    You can simply use the add-on domain feature in order to achieve this.

    Add-on domain feature lets you point a domain to a particular sub-folder of the main domain.

    For example,

    parked1.com >> maindomain.com/parked1

    parked2.com >> maindomain.com/parked2

    parked3.com >> maindomain.com/parked3
     
  11. richardwing

    richardwing Member

    Joined:
    Sep 18, 2002
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    AZ
    Thank you.

    I knew how addons work. I was hoping to set them as parked so I can still use content / scripts from the main domains sub folders. I want to share the content qand scripts.
     
  12. pixie.027

    pixie.027 Registered

    Joined:
    Aug 31, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
     
  13. pixie.027

    pixie.027 Registered

    Joined:
    Aug 31, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    OH MY WORD! i got it to work.. now i feel really dumb :(
    thanks anyways!
     
Loading...

Share This Page