views:

22

answers:

1

I've got a site www.example.com on one server. I'd like to create www.example.com/blog on another server/host.

A) Can I do this? B) How can I do this?

I've read a bit on using Apache's mod_proxy, proxypass, and ProxyPassReverse, but I'm not gifted enough with Apache or server mgt to know if I'm on the right track or not. Or, if there are other options to doing what I want.

To be clear, I do not want a subdomain like blog.example.com. I know how I COULD do that with DNS, but I don't believe DNS is an option for subdirectories.

+2  A: 

This is not doable nicely IMO. As you say, you would need a proxy based solution that fetches the content from the blog server and serves it to the user.

That has the serious downside that any traffic on your blog will have to run through your primary host, eating up bandwidth, resources and traffic volume.

Is a redirect (i.e. www.domain.com/blog doing a header redirect [visible in the browser's address bar] to blog.otherhost.com) an option?

If not, check out the documentation on mod_proxy. The basic example for a reverse proxy looks good already:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar 
Pekka
+1 but I would say it may or may not be a _serious_ downside, depending on the content involved and the resources available.
David Zaslavsky
@David true, it depends on the context.
Pekka
Joe Fletcher
@Joe the external server will do the main processing work. The primary server will just pass data through. If there is no traffic limitation problem, it may be all right. Still, if it's for SEO reasons, I would consider a slow migration using `302` redirects to the new domain name - you'll take a hit but I think it doesn't have to be devastating. Running a second server, and proxying it through seems like such a waste...
Pekka