

Ask HN: Way to make blog service at www.mydomain.com/blog vs blog.mydomain.com? - ai09

I've been looking for a Rails-powered drop in blog for domains so that I can have www.mydomain.com/blog instead of blog.mydomain.com. As I understand it, Google's PageRank algorithm assigns PageRank scores to each subdomain separately. Thus great blog posts on blog.mydomain.com will improve the PageRank score of blog.mydomain.com separate from the PageRank score of www.mydomain.com. For example, according to http://www.prchecker.info/check_page_rank.php, blog.twilio.com has a PR of 5 while www.twilio.com has a PR of 6. blog.shopify.com has a PR of 6 while www.shopify.com has a PR of 7. My naive guess is that if all the links to blog.shopify.com instead pointed to www.shopify.com/blog/... then the PR for www.shopify.com would be even higher.<p>Can anyone recommend a rails plugin that will add standard blog functionality (posts, comments, tags, feeds, etc.) into existing rails apps? Or is there some way to 'symlink' (not the right word but a proxy for the idea) the www.mydomain.com/blog/... to use posterous, wordpress, tumblr, etc. underneath?<p>Lastly, I'd like to avoid rolling my own. I created a simple posts controller in a pinch for a site I started on Thursday (www.formds.com) which was great in allowing links to my main site, but I'd really like to avoid recreating the wheel. It looks bad and is time I'd rather spend elsewhere. I'd _love_ a symlink'd tumblr/posterous/wordpress running under my domain.<p>Thanks for thoughts,<p>Robert
======
patio11
a) You're right to want to do this.

b) This is not difficult to accomplish via Nginx (or whatever) using reverse-
proxying.

<http://www.pastie.org/1071380>

[http://www.kalzumeus.com/2009/08/22/using-wordpress-and-
rail...](http://www.kalzumeus.com/2009/08/22/using-wordpress-and-rails-on-the-
same-domain/)

~~~
ai09
Thanks, Patrick. Your suggestion is perfect.

------
sr3d
I have the exact setup for Marrily.com: <http://marrily.com/blog>. The main
site runs Rails 3RC, and any requests begin with /blog will get proxied over
to the WordPress site running locally.

Basically I have Apache running on port 81 locally, and I setup the WordPress
to a "blog" folder underneath the DocumentRoot.

Then within the server { } configure block in nginx, I have

server { # your server settings, like "listen 80;"

    
    
      location /blog {
        proxy_redirect off;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #add_header X-Marrily-DEBUG "$Host";    # turn this on to test the header
        proxy_pass http://127.0.0.1:81;
      }
    

}

You will have to update the WordPress config to tell that it's installed in a
sub folder and not at the root. It took me a while to figure out (all other
articles online will tell you to update the wp-config.php file to define the
different constants, but it's not the right spot for WordPress 3). You'd have
to update the wp_options table as well to fix the path. Here's a screenshot:
<http://cl.ly/468cab133aca48eea173>

Good luck!

(this post should go to StackOverflow, but since I just went through the exact
same experience, I thought I'd share it)

------
Travis
Are you sure your motivation is correct, WRT pagerank?

I'd always thought that PR applies to your PAGES only. not domains. So, in
your example, it's not that blog.twilio.com has a higher PR than
www.twilio.com, it's that the blog.twilio.com INDEX page has a higher PR than
the www INDEX page.

Thus, your PR isn't really affected by being on a subdomain, as the juice that
flows through the system doesn't care about the sub/domain, only about the
page and what points to it.

Please correct me as needed.

------
unshift
just note that you can't nicely reverse proxy 3rd-party blogs (tumblr,
posterous, hosted wordpress) if they aren't using relative links (which they
probably aren't); and even if they are your server will still be bearing the
bandwidth load and increasing the page latency, of which the former is
undesirable and the latter could reduce your pagerank.

------
rmc
If you're using Apache, then it should be easy to do with a rewrite rule, or
proxy pass.

