What should be the syntax when it is test.example.com/test and not example.com/test ?
Subdomain redirect
Redirect subdomain test.example.com to example.com/test without creating a vhost.
RewriteEngine On
RewriteCond %{HTTP_HOST} www.?test.example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/test/
RewriteRule .*$ /test/$1 [L]