问题
Is it possible to for a domain e.g. www.myclient.com to have a sub directory hosted on a completly different (our) server?
They don't want to point subdomain.myclient.com to our servers so they want it as folder www.myclient/subdomain/
Thanks in advance.
回答1:
As discussed in the comments, your only option is a Proxy. Everything else (Like mod_rewrite / Alias) will do a header redirect, and expose the target address to the user.
However, Apache's proxying doesn't seem to be that complicated. The most basic example is
ProxyPass /mirror/foo/ http://backend.example.com/
Note that a proxy will of course double your traffic, because every byte requested will have to be fetched from the remote machine.
回答2:
There are two different mechanisms that you might be able to use to accomplish this. What you use will depend on the setup you have as well as what permissions you have on the server from the hosting company if this is not a dedicated server.
The first option is to map to the second server using the file system, then use mod_alias to point the subdirectory to the mapped location. This requires that the two servers be networked together, for instance if you have one server dedicated to a specific server, but own and can safely network the servers at the file system level.
Another option would be to set up Apache to act as a proxy. This does require some advanced programming to configure but the system can be set up so that requests to the specified subfolder would be passed on to the remote web server. This can be used when the remote server can't be networked at the file system level, but lets you simulate the workings of a remote subdomain.
回答3:
Could you use Amazon CloudFront because it can map different paths to differnt servers ?
来源:https://stackoverflow.com/questions/6019328/sub-directory-to-a-different-server