php redirect pages under folder to different domain

Posted by matt wilkie on Server Fault See other posts from Server Fault or by matt wilkie
Published on 2010-03-11T23:02:47Z Indexed on 2010/03/12 0:37 UTC
Read the original article Hit count: 277

Filed under:
|

Using php, how might I redirect all pages under a folder to a different domain?

Current site:

http://www.example.org/dept
http://www.example.org/dept/stuff
http://www.example.org/dept/more
http://www.example.org/dept/more/stuff

New site:

http://www.example-too.org/pets/stuff
http://www.example-too.org/pets/more
http://www.example-too.org/pets/more/stuff

I've learned about how to redirect a single page:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.example-too.org/pets/more/stuff" );
?>

but how to apply this to dozens of pages without creating a php redirect for each one? I can't do this using apache mod_rewrite and .htaccess is disabled.

thanks.

© Server Fault or respective owner

Related posts about php

Related posts about beginner