I need to write rewrite rule, to redirect subdomains to sub-folder.
Example: subdomain.domain.io should be redirected to domain.io/apps/subdomain, and test7.domain.io should be redirected to domain.io/apps/test7 and so on...
in .htaccess file I can catch the subdomain via following condition:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.io$
RewriteRule ?
But how to make redirection?
Thanks
You can use this rule in your site root .htaccess:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
is used to prevent looping of this rule.%1
is back-reference of subdomain text captured in 2ndRewriteCond
.