php代理目录

时间:2012-08-10 22:39:10

标签: php proxy webserver

假设我们在服务器上有一个目录Loacated Really FAR

server1的。{domainUS} / MAINDIR /

但我有服务器

{domain.UK}

我想创建一个指向我的服务器的子域,而不是将其指向我的其他服务器server1.{domainUS},因为我的远程服务器允许http到通过服务器传输.... 所以我需要一个PHP代理脚本,将完成的目录转发到服务器

实施例..

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

Example2,我还需要它与php查询等完美配合..

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

1 个答案:

答案 0 :(得分:0)

将此代码放入server1.{domainUS}的服务器配置中(假设Apache):

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

或者,如果您无法更改配置,则可以将Directory标记的内容放在.htaccess中的maindir文件中。