php代理目录

Lets say we got a directory on a server Loacated Really FAR

server1.{domainUS}/maindir/

but i have a main server

{domain.UK}

i will like to create a subdomain pointed to my main Server instead of pointing it to my other server server1.{domainUS} because my remote server only allows http to be transmitted to via main server.... so i need a PHP Proxy like script that forwards the compleate dir to the main server

Example..

server1.{domainUS}/maindir/testube/testfile.html <==test file
proxy.{domain.UK}/testube/testfile.html  <==test file

Example2, i also need it to work nicely with php queries ect..

server1.{domainUS}/maindir/testube/testfile <==test php document
proxy.{domain.UK}/testube/testfile  <==test php document

Put this code in your server config for server1.{domainUS} (assuming Apache):

<Directory "maindir/">
    RewriteEngine On
    RewriteCond %{QUERY_STRING} (.*)
    RewriteRule ^(.*?)$ http://google.com/%{PATH_INFO}
</Directory>

Or if you can't change the config, you can put the contents of the Directory tag inside an .htaccess file in maindir.