WordPress root in subdirectory

Home Forums BulletProof Security Free WordPress root in subdirectory

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #38649
    BHA
    Participant

    Aloha,

    I’m wondering how to get BPS to recognize that the wordpress install is in a subdirectory.

    Environment:
    Bluehost shared hosting with primary domain (boydhanaleiako.me) in public_html.
    Website is responding to public_html/boydhanaleiako.
    public_html/.htaccess has the following:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?boydhanaleiako.me$
    RewriteCond %{REQUEST_URI} !^/boydhanaleiako/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /boydhanaleiako/$1
    RewriteCond %{HTTP_HOST} ^(www.)?boydhanaleiako.me$
    RewriteRule ^(/)?$ boydhanaleiako/index.php [L]
    </IfModule>
    

    Problem:
    The BPS plugin function that does the htaccess modifications is doing so in the public_html htaccess file which messes things up. It “should” be modifying the public_html/boydhanaleiako/.htaccess file.

    #38652
    AITpro Admin
    Keymaster

    Go to the WordPress > Settings menu > General sub-menu > post what you see for these General settings below in your forum reply.

    WordPress Address (URL)
    Site Address (URL)

    #38656
    BHA
    Participant

    Both are https://boydhanaleiako.me

    “However”… Bluehost bulks all my sites into public_html. And anything for boydhanaleiako.me needs to be in the public_html/boydhanaleiako subdir. Anything in the public_html dir at level 1 globally affects all the other sites.

    So when the plugin edits the public_html/.htaccess it does affect the others. The front page will load, but clicking on the links will result in 404’s for all the sites.

    For some reason the other site’s that I have the BPS plugin in works accordingly. It’s just this site. I believe it’s because it’s the “Primary Domain” for my account so it has access to the WWW root of public_html.

    #38658
    AITpro Admin
    Keymaster

    Yeah, that is exactly what I thought would be the problem. The normal standard settings for a WordPress “GWIOD” type site are…

    https://wordpress.org/support/article/giving-wordpress-its-own-directory/#method-ii-with-url-change

    3. In WordPress address (URL): set the address of your main WordPress core files. Example: http://example.com/wordpress
    4. In Site address (URL): set root directory’s URL. Example: http://example.com

    The newer method for GWIOD site types, which came about many years later, does the rewriting from an htaccess file without changing the WordPress address (URL), which appears to be the method that BlueHost is using > https://wordpress.org/support/article/giving-wordpress-its-own-directory/#method-i-without-url-change

    BPS uses the original standard GWIOD method where you had to change the WordPress address (URL) setting for where the actual WordPress installation folder was. So since the WordPress address (URL) is pointing to the same path as your Site address (URL) then that is why the htaccess file in your hosting account root folder (public_html) is being changed instead of the htaccess file in your actual WordPress installation folder.

    Logically what should work would be to change the WordPress address (URL) setting to your actual WordPress installation folder.  CAUTION!!! Making the option setting change could possibly prevent you from logging back into your website.  IMPORTANT!!!  Make a database backup of your site BEFORE changing the WordPress address (URL) setting just in case you are unable to login to your site again after changing that setting. If you are unable to log back into your website after making that option setting change you will then need to use the database backup you made to restore your database so you can log back into your website. There is 10% chance that could happen so definitely make a database backup first before changing the WordPress address (URL) setting.

    #38661
    AITpro Admin
    Keymaster

    Following up on this. Did you change the WordPress address (URL) setting? Did that take care of the problem?

    #38667
    BHA
    Participant

    I’m contemplating if I should go that route. Doing so would provide fact that it’s in a sub-directory of a publicly accessible directory. Thus leading to one poking around the root domain instead of just the WP directory.

    #38669
    AITpro Admin
    Keymaster

    From a Browser no one would be able to “poke” around in any of your hosting account directories.  If you are talking about someone “poking” around at your hosting account file/folder level then that would be game over. Only hosting account user accounts have access to hosting account file/folder/directory level stuff.

    #38691
    BHA
    Participant

    I’m thinking more about bruting for other sub-directories…. There’s also the whole aesthetic of the URL.

    #38692
    AITpro Admin
    Keymaster

    Site address (URL) is the WordPress setting for the website URL that is displayed to visitors. So your website URL would still be the same.  Logically nothing would change except that since BPS uses the WordPress address (URL) option setting for the path to the actual WordPress installation folder then BPS would now write to the htaccess file in the WordPress installation folder instead of the htaccess file in the hosting account root folder.  I don’t think any brute force stuff would be an issue.

    #38693
    BHA
    Participant

    So just change the “Site Address”. I’m not exactly sure how the two addresses are differently used.

    #38694
    AITpro Admin
    Keymaster

    Do not change the Site Address (URL) option setting.  Change the WordPress Address (URL) option setting to:  https://boydhanaleiako.me/boydhanaleiako

    WordPress Address (URL) – is the WordPress installation folder URL. Internally (WP DB) what this option setting does is it contains the actual file/folder path to your WordPress installation folder (WP Core files). BPS and other plugins use this file/folder path DB option setting to find/get your website’s actual WordPress installation folder path.

    Site Address (URL) – is the URL for your website. This is the URL that is displayed publicly to any visitors to your website.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.