I have a problem with rewrite condition and rule in Apache2. I want to have dynamic subdomains and dynamic folders, which will rewrite to php script. For example:
sub1.example.com/folder1 => do.php?a=sub1&b=folder1
sub2.example.com/folder2 => do.php?a=sub1&b=folder2
It will looks like every subdomain has own folders. But some subdomain (admin etc) will not be rewrited.
I know how to rewrite subdomain:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(^.*)\.example.com/ [NC]
RewriteRule ^(.*)$ do.php?a=%1 [L,P]
but I don't know, how to do dynamic folders in subdomains.
Thanks a lot