Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I tell Apache to do an internal redirect from PHP?

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?

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.

Thanks!

like image 414
bnjmnhggns Avatar asked Nov 06 '08 20:11

bnjmnhggns


1 Answers

virtual() may do what you want. I'm not sure, I've never tried it.

Note that include() and require() will work if you're just calling HTML or PHP pages, plus be portable to other PHP installations.

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.

like image 183
Powerlord Avatar answered Oct 28 '22 08:10

Powerlord