更新时间:2023-01-08 10:26:18
尝试将其放在.htaccess文件中:
Try putting this in your .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com
RewriteRule ^(.*)$ http://domain.com/subdomains/sub/$1 [L,NC,QSA]
对于更一般的规则(适用于任何子域,而不仅仅是 sub
)用以下替换最后两行:
For a more general rule (that works with any subdomain, not just sub
) replace the last two lines with this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/subdomains/%1/$1 [L,NC,QSA]