How do you mask one subdomain to be a directory within another domain, such as rewriting the URL to be that of another domain?
I want to set up a Wordpress blog for my Ruby on Rails on Engineyard site, site.com . The way I've done it in the past is with blog.site.com going to a different server to host that, so never shall the Ruby and PHP meet. However, for my new site, I'd love to have the Wordpress blog as a subdirectory, so it would be like site.com/blog -- Yes, a ruby site with a PHP /blog subdirectory.
If we do this on separate servers (since EY is Ruby and they开发者_如何转开发 recommend using a separate server for Wordpress blogs), is there a way to have, say, a separate server (blog.site.com) that then invisibly rewrites the URL to be site.com/blog ?
Thanks for your help!!!
If you use a single Apache server with Phusion and mod_php you can do this by Rewriting requests from example.com/blog/* to blog.example.com/* before you get to your virtual hosts. In your VHosts you define example.com as your Rails app and blog.example.com as your Wordpress app.
You can't do it in an environment without both PHP and Ruby (duh), and doing it cross-server limits you to proxying every request or just redirecting.
Not really. site.com is one server, blog.site.com is another. When you're at site.com/blog you're still at the first server. The browser will simply not try to connect to the other server to ask for a file we're looking for on the first server. This is the idea behind the URL.
A nice hack you could do would be to create site.com/blog/index.html with frames and load blog.site.com in one of the frames.
精彩评论