【发布时间】:2014-09-17 09:17:45
【问题描述】:
我已经阅读了所有关于 .htaccess 的教程,但仍然不知道:
- 我可以将子域作为变量重定向到另一个子域吗?
.htaccess 现在看起来是这样的:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^.*domain.com$ [NC]
RewriteRule ^(.*)$ http://anotherdomain.com/ [R=301,L]
我要重定向:
subdomain.domain.com
收件人:
subdomain.anotherdomain.com
未指定子域。
所以它应该重定向:
subdomain1.domain.com
收件人:
subdomain1.anotherdomain.com
还有:
subdomain2.domain.com
收件人:
subdomain2.anotherdomain.com
还有:
subdomain3.domain.com
收件人:
subdomain3.anotherdomain.com
等等……
是否可以将subdomainx 传递给$1,然后重定向到$1.anotherdomain.com?
【问题讨论】:
标签: php apache .htaccess redirect