• I installed WordPress in a subdirectory of public_html named goodwork.

    I copied WordPress’ .htaccess and index.php (modified to accommodate the subdirectory) from subdirectory goodwork to root directory public_html.

    So now there are two (2) .htaccess files and two (2) index.php files.

    I want to add two simple pieces of code to my .htaccess file, but I’m not sure WHICH .htaccess file to modify… The one in subdirectory goodwork, or the one in root directory public_html?

    The code I want to add is:

    a) Block directory listing/browsing:
    Options -Indexes

    b) All POST requests and access to wp-admin files must originate from MY DOMAIN NAME:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{HTTP_REFERER} !^https://(.*)?mydomain\.com [NC]
    RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
    RewriteRule ^(.*)$ - [F]
    </IfModule>

    Thanks

    • This topic was modified 7 years, 1 month ago by BothHands.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP in a subdirectory: WHICH .htaccess gets these mods?’ is closed to new replies.