Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress WP in a subdirectory: WHICH .htaccess gets these mods?

Discussion in 'Misc WordPress Requests' started by BothHands, Oct 12, 2017.

  1. BothHands


    WP in a subdirectory: WHICH .htaccess gets these mods?, by BothHands

    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]


    WP in a subdirectory: WHICH .htaccess gets these mods?

Share This Page

Monarch Social Sharing Plugin