假设我们在服务器上有一个目录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
答案 0 :(得分:0)
将此代码放入server1.{domainUS}
的服务器配置中(假设Apache):
<Directory "maindir/">
RewriteEngine On
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^(.*?)$ http://google.com/%{PATH_INFO}
</Directory>
或者,如果您无法更改配置,则可以将Directory
标记的内容放在.htaccess
中的maindir
文件中。