使用PHP从一个端口重定向到另一个端口

时间:2020-06-30 06:18:48

标签: php html

我在localhost:8000/index.html有一个Nodejs游戏,我的网站在localhost:80。如何使用PHP从端口80重定向到8000?

header("Location: localhost:8000/index.html");

1 个答案:

答案 0 :(得分:0)

在此已回答:

PHP Redirect Same Address Different Port

这样做的好处是它是动态的。这意味着,如果您曾经碰巧拥有另一个不同于localhost的URL,那么它也将起作用。