My root domain htaccess: Options +FollowSymLinks RewriteEngine on RewriteBase / ErrorDocument 404 /404.php RewriteCond %{`HTTP_HOST`} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ `https://%1/$1` [R=301,L] RewriteCond %{HTTPS} !on RewriteRule (.*) `https://%{HTTP_HOST}%{REQUEST_URI}` [R=301,L] In my subfolder htaccess: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} `^(www\.example\.com)?$` RewriteRule ^(.*)$ `https://example.com/subfolder/$1` [R=301,L]
Wehn I type in example.com/any-wrong-url
, it will redirect to 404 page, that is correct.
But when I type in example.com/subfoler/any-wrong-url
it can not redirect to 404 page. Where do I something wrong?