0

我想要一个子域来镜像根域(例如:sub.root.com 镜像 root.com),我想通过 .htaccess 或 php 来完成此操作,首选 .htaccess。

4

2 回答 2

1

重写条件 %{ENV:REDIRECT_STATUS} ^$

RewriteCond %{HTTP_HOST} ^((子域).)?([a-zA-Z0-9-]+.([a-zA-Z]{2,3}(:[0-9]+)?) )$ [NC]

重写规则 ^(.*)$ /%{REQUEST_URI} [QSA,L]

于 2010-12-06T07:50:14.810 回答
0

您不必编写任何 PHP 代码或修改.htaccess. 您只需修改/etc/hosts(Linux) 或%SystemRoot%/Windows/system32/drivers/etc/hosts(Windows)即可完成此操作

于 2010-11-14T20:54:37.130 回答