• I began as a complete rookie a little over two years ago by having WordPress auto-installed in what I later learned to be my /public_html/ folder (or directory, if you prefer). Not long after that, I purchased an Add-On Domain and installed its WordPress in an added /public_html/addondomain/ folder…then soon also decided to move my Primary Domain into its own /public_html/primarydomain/ folder. So, and over time, I now actually have this today:

    /public_html/addondomain3/
    /public_html/addondomain1/
    /public_html/addondomain2/
    /public_html/addondomain2/subdomain/
    /public_html/primarydomain/

    That is all working just fine, of course, but now I want to either move my Primary Domain back to the top of the stack or possibly even back into /public_html/ so I would no longer have to deal with its needing two .htaccess files…

    /public_html/.htaccess for re-pointing the Domain to its folder;
    …and…
    /public_html/primarydomain/.htaccess in its actual “root” folder.

    Any thoughts, ideas or opinions as to which way I should go?!

    Many thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • My suggestion is to have the primary domain in the public_html directory, only one .htaccess

    And put all addon domains into their own directories, there is no requirement that they be in directories below public_html, this is just the default recommendation in cPanel (and probably elsewhere). Each name goes to its own directory, no interactions, no crossovers.

    Thread Starter leejosepho

    (@leejosepho)

    My suggestion is to have the primary domain in the public_html directory, only one .htaccess

    And put all addon domains into their own directories…

    If I am understanding you correctly, that means I could altogether eliminate public_html and have something like this:

    /home/myaccount/primary/
    /home/myaccount/addon1/
    /home/myaccount/addon2/
    /home/myaccount/addon2/subdomain/
    /home/myaccount/addon3/

    Yes? If so, that would maintain the kind of neatness and order I like as well as only needing one .htaccess for my primary.

    Thread Starter leejosepho

    (@leejosepho)

    Update:

    I just realized removing /public_html/ might not be possible, but maybe I could still have this:

    /home/myaccount/public_html/
    /home/myaccount/public_addon1/
    /home/myaccount/public_addon2/
    /home/myaccount/public_addon2/subdomain/
    /home/myaccount/public_addon3/

    Many thanks!

    Edit: A Support Tech at BlueHost has just told me all domains other than my Primary domain must be in folders inside /public_html/, so it looks like I am back at my initial dilemma of choosing between:

    1) a bit of disorder (at least as I see things) with my Primary Domain in /public_html/;
    2) having two .htaccess files for my Primary Domain while in a sub-folder.

    I think you are correct in thinking that /public_html is compulsory.

    If you are using cPanel to do your host management, then you get to set your directory when you configure an addon domain, (or sub-domain), the default is within public_html, but I always edit this at the time.

    Thread Starter leejosepho

    (@leejosepho)

    If you are using cPanel to do your host management, then you get to set your directory when you configure an addon domain, (or sub-domain), the default is within public_html, but I always edit this at the time.

    Yes, and I have done that before, but in the latest cases I had made the new directories first and then gone to cPanel only to assign and point them.

    “…so I would no longer have to deal with its needing two .htaccess files…”

    The optimum architecture/structure for htaccess files is for each site to have its own htaccess files so that you can control all security or other htaccess directives/rules per site. You want to compartmentalize things since that gives you much more refined control. You can of course choose to do everything from a single parent htaccess file in the hosting account root folder, but that would not be the optimum architectural/structural design.

    See this forum topic for how you can use rewriterules to not apply parent htaccess file directives/rules to child folders/sites.
    https://forum.ait-pro.com/forums/topic/htaccess-files-for-multiple-website-domains/

    Also if these are WordPress sites then each WordPress site should have its own htaccess files. You can of course choose not to do that, but you would need to create a very complex/advanced parent htaccess file in order for all child sites to rewrite correctly.

    Thread Starter leejosepho

    (@leejosepho)

    Also if these are WordPress sites then each WordPress site should have its own htaccess files. You can of course choose not to do that, but you would need to create a very complex/advanced parent htaccess file in order for all child sites to rewrite correctly.

    Yes, understood, and I definitely do have exclusive files for each site, and with BulletProof Security being the primary provider always calling the shots for all sites! However, and maybe because of how server/cPanel things work at BlueHost, I *must* have an initial /public_html/.htaccess file to point my Primary Domain to its sub-folder…
    https://my.bluehost.com/cgi/help/347#redirect
    …where BPS then takes over. When I first posted here in this thread, I was hoping to eliminate that first file without having to move my Primary Domain back into /public_html/, but that now seems to not be possible. As a work-around, however, this morning I switched a lower-traffic site into position as my Primary Domain, so now the one I was concerned about has become an Add-On with BPS covering everything including any redirects I might want to add at the top of BPS Custom Code.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Seeking your opinion on the location of a Primary Domain’ is closed to new replies.