Mod重写通配符文件夹

Just wondering if its possible to use a wildcard domain in my htaccess file with a folder.

For example redirecting (^.*).test.com/myfolder/ to folder/test.php?id=$1

This is what I have so far but no idea how to add a folder after the URL:

RewriteCond %{HTTP_HOST} ^(^.*)\.test\.com
RewriteRule ^ folder/test.php?id=%1

Thanks!

You can try this rule:

RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)\.test\.com
RewriteRule ^$ folder/test.php?id=%1

We rewrite for example http://www.test.com/ to http://www.test.com/folder/test.php?id=www

Is this what you want ?