我可以告诉阿帕奇做从PHP内部重定向? [英] Can I tell Apache to do an internal redirect from PHP?
问题描述
有什么办法,从与Apache mod_php的称为PHP脚本,告诉Apache做一个内部重定向到其他一些文件?
Is there any way, from a PHP script called from mod_php with apache, to tell apache to do an INTERNAL redirect to some other file?
我不想读/需要从PHP文件,并吐了出来,我觉得这是更有效地传递这一关到Apache。我相信这可以用mod_perl的做,我很好奇,如果有一种方法使用PHP / mod_php的/阿帕奇做到这一点。
I do not want to read/require this file from PHP and spit it out, I think it'd be more efficient to pass this off to Apache. I believe this can be done with mod_perl and I'm curious if there's a way to do it with PHP/mod_php/apache.
谢谢!
推荐答案
虚拟()可以做什么你要。我不知道,我从来没有尝试过。
virtual() may do what you want. I'm not sure, I've never tried it.
请注意,其中包括()和require()将工作,如果你只是打电话HTML或PHP页面,再加上移植到其他PHP安装。
Note that include() and require() will work if you're just calling HTML or PHP pages, plus be portable to other PHP installations.
我依稀记得使用位置头与当地网址为做一个内部重定向(如标题(位置:/uri/here.php);
,但我不能在这里进行测试,以确保
I vaguely remember that using a Location header with a local url as doing an internal redirect (such as header("Location: /uri/here.php");
, but I can't test it here to make sure.
这篇关于我可以告诉阿帕奇做从PHP内部重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!