Everything is laid out through wordpress, so when a request for something like /sub/no_file.html and it does not exist, wordpress routes it through its index.php , because it satisfies the conditions !-f and !-d (and not the existing one file, not an existing directory). He then decides that he cannot find the resource for /sub/no_file.html , so he displays his own 404 file.
If you want requests that go to / sub to bypass wordpress routing, so that if a file is requested in /sub/ that does not exist, /404.html will be serviced, you can add this line right before the RewriteRule . /index.php [L] RewriteRule . /index.php [L] in your wordpress rules so they look like this:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/?sub/ RewriteRule . /index.php [L] </IfModule>
source share