• Hi – I am completely new to wordpress so please forgive the newbie question.

    I have one site already set up on my hosting with wordpress installed. I want to set up at least 2 more completely independent sites but have been warned that for security I need to make sure these are in separate directories ‘above public_html’ so if one site is hacked they cannot get access to the others directly.

    I have looked at filemanager and I have a root directory with the WP files of the current installation in it directly. Do I simply add a new directory for each new domain and install WP to this in each case or is it more complicated than that?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    This would depend on your hosting setup. Your best of asking your provider.

    Kind regards
    Jamie

    Thread Starter lorraineemmott

    (@lorraineemmott)

    Yes I did ask but got some contradictory information from 2 different support agents so decided to research it elsewhere to be sure.

    My set-up is as described above.

    I have something like this:

    /public_html/.htaccess (redirecting Primary Domain)
    /public_html/primarydomain/
    /public_html/addon1/
    /public_html/addon2/

    At my particular host, my Primary Domain can only be assigned to /public_html/. So, and to help keep things neat-and-orderly overall, I use the .htaccess redirect in /public_html/ in order to have my Primary Domain in its own sub-folder just like for each Add-On Domain. Then at that point, each Add-On is cPanel-assigned to its own folder and each-and-every domain I have is completely independent from any other. Each has its own .htaccess as written by BulletProof Security from within each WordPress installation, and each installation also has its own database at the server.

    Thread Starter lorraineemmott

    (@lorraineemmott)

    Hi there

    Yes I see what you mean – that is exactly what I would like to achieve.

    I use iPage for my hosting and when I look at the file manager there is no public_html – would this just be what is shown as root? The file structure with just the primary domain looks as follows:

    root/cgi_bin
    root/stats
    root/wp-admin
    root/wp-content
    root/wp-includes

    Thanks for your help.

    Yes, your “root” seems to be the same as my own “public_html”.

    For me, the first question would be that of whether to move your current installation into its own sub-folder. Doing that is not necessary, it would only be a matter of convenience- or neatness-of-arrangement:

    root/cgi_bin
    root/stats
    root/add-on-1
    root/add-on-2
    root/wp-admin
    root/wp-content
    root/wp-includes

    -or-

    root/cgi_bin
    root/stats
    root/add-on-1
    root/add-on-2
    root/primary

    root/primary/wp-admin
    root/primary/wp-content
    root/primary/wp-includes

    With multiple domains to maintain, you will soon find yourself editing separate files with the same names for separate domains, and there is where having each in its own sub-folder can make a huge difference in helping to keep all of that straight!

    Moving your primary to a sub-folder can be done within WordPress or by using .htaccess prior to it, and that second method is what I use. Simply copy (keeping the originals as backups for now) all WordPress-related files in “root” to your new “root/primary” folder, then place your edited version of this into “root” as your new .htaccess there and log in:

    ## from https://my.bluehost.com/cgi/help/347#redirect
    # .htaccess main domain to subdirectory redirect
    # Do not change this line.
    RewriteEngine on
    # Change example.com to be your main domain.
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    # Change 'subdirectory' to be the directory you will use for your main domain.
    RewriteCond %{REQUEST_URI} !^/subdirectory/
    # Don't change the following two lines.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Change 'subdirectory' to be the directory you will use for your main domain.
    RewriteRule ^(.*)$ /subdirectory/$1
    # Change example.com to be your main domain again.
    # Change 'subdirectory' to be the directory you will use for your main domain
    # followed by / then the main file for your site, index.php, index.html, etc.
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    #RewriteRule ^(/)?$ subdirectory/index.html [L]
    ## index.php for WordPress
    RewriteRule ^(/)?$ subdirectory/index.php [L]

    For your add-ons, simply copy the *content* of a freshly-unzipped /wordpress/ folder into each new root/add-on#/ folder, and then it looks like here is how you would assign an Add-On Domain to its destination installation:
    https://www.ipage.com/support/tutorials/view_tutorial.bml?kbid=6104

    Thread Starter lorraineemmott

    (@lorraineemmott)

    Wow leejosepho – thanks so much for your help – you have been unbelievably generous with your time and I really do appreciate it.

    You have made it all very clear and I feel I can finally get on and make some progress.

    Thanks again – I am so grateful.

    Lorraine

    You are most welcome!

    Give careful consideration to the matter of database name/s and/or database table_prefix/es since doing so can also be quite convenient by coordinating that labeling with your folder arrangements. As noted in the wp-config-sample.php file:

    /**
     * WordPress Database Table prefix.
     * You can have multiple installations [more than one table_prefix] in one
     * database if you give each [WordPress installation] a unique prefix.
     * Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wp_';

    You do not want to use the ‘wp_’ default known by every hacker in the world, and just ask if you might have any questions!

    Enjoy.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Installing a second and third domain’ is closed to new replies.