我需要将未知的子域转换为变量,因此适用以下内容:
http://test.example.com/→http://www.example.com/?domain=testhttp://xyz.example.com/→http://www.example.com/?domain=xyzhttp://www.example.com/→http://www.example.com/http://www.example.com/pageA/→http://www.example.com/pageA/http://fish.example.com/pageB?somevar=something→http://www.example.com/pageB?somevar=something&domain=fishhttp://www.example.com/pageB?somevar=something→http://www.example.com/pageB?somevar=somethinghttp://fish.example.com/pageB→http://www.example.com/pageB?domain=fish
如您所见,我需要做的就是将任何子域替换为www并将子域名附加为名为domain的 get var 。
我真的迷路了。
编辑:哦,我还希望用户仍然在 url 中看到子域,而不是重定向。