• Resolved Anonymous User 14379775

    (@anonymized-14379775)


    Hi!

    I need to exclude 1 folder (and all subfolders and files inside) in the root, say “folder” so it works without WP.
    I have subdirectories based Network with standard .htaccess:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    What’s missing here? Because subfolders are still shown by WP…

    RewriteEngine On
    RewriteBase /
    RewriteRule ^/folder($|/) - [L] 
    RewriteRule ^index\.php$ - [L]
Viewing 2 replies - 1 through 2 (of 2 total)
  • You can add a single rule:

    RewriteRule ^(folder)($|/) – [L]

    Place that after the RewriteBase / line

    That says if you match that rule stop executing more rules. You can see other rules like it at the bottom of the list set to bypass wp-content, etc.

    You can read this page for more info.

    Thread Starter Anonymous User 14379775

    (@anonymized-14379775)

    It works! Thanks @smithjw1

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude folder – htaccess’ is closed to new replies.