如何更改PHP中的标头位置以重定向到子域?
问题描述:
how can i make a PHP script to use the header location feature and redirect the user to my sub-domain?
I've tried the meta refresh thing but that looks a little strange having it in a echo... I need something fast and not clunky, So i turned to headers.
如何让PHP脚本使用标题位置功能并将用户重定向到我的子域? / p>
我已经尝试了元刷新的东西,但在回声中看起来有点奇怪......我需要快速而不笨重的东西,所以我转向标题。 p> div>
答
So you want to make a redirect in PHP using headers? Not hard. No extra code is needed to redirect to a subdomain.
Try the code below:
<? die(header('Location: http://mysubdomain.example.net/')); ?>
You can change the http://mysubdomain.example.net/