I'm currently have this:
RewriteEngine On
RewriteBase /
RewriteRule ^(index\.php)?$ /test/ [L]
(index.php seems to be necessary, it's from here: How can I use .htaccess rewrite to redirect root URL to subdirectory?)
System: MacBook Pro - XAMPP 8.1.2 (installer not VM)
I’m trying to rewrite not redirect (not changing adressbar), everything to /test/
Typing in:
localhost/
should show content of
localhost/test/
with all subdirectories localhost/test2/ -> localhost/test/test2/
…
Ok this works (as far as I understand 🙈):
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteRule (.*) /subdirectory/%1 [L]
%1
get's URI from RewriteCond.
That's necessary 'cause (.*)
won't give us the whole URI (path + index.html ...), it's just the path.
And the same for nginx:
if ($uri !~ "^/subdirectory/"){
rewrite /(.*) /subdirectory$uri last;
}