开发者

How to setup a root domain mirror for a subdomain using .htaccess or php

I want a subdomain to mirror the root-domain (ex: sub.root.com mirroring 开发者_如何转开发root.com) and I want to accomplish this via .htaccess or php, with .htaccess prefered.


RewriteCond %{ENV:REDIRECT_STATUS} ^$

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

RewriteRule ^(.*)$ /%{REQUEST_URI} [QSA,L]


you don't have to write any PHP code or modify .htaccess. you can accomplish this by just modifying /etc/hosts (Linux) or %SystemRoot%/Windows/system32/drivers/etc/hosts (Windows)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜