Sacha
Sacha

Reputation: 2007

In a Rails app, how can I have a Tumblr or Wordpress blog live at appname.com/blog instead of blog.appname.com?

I recently read these notes about SEO which say that you loose "Google juice" by having your blog live on a subdomain.

I've currently got a tumblr blog set up on blog.myapp.com. What do I need to do to have the same blog accessible via myapp.com/blog instead?

Upvotes: 1

Views: 495

Answers (1)

sled
sled

Reputation: 14625

the pure ruby solution:

config/routes.rb

match "/blog(/*path)" => redirect{ |params| "http://www.google.com" + (params[:path] ? "/?q=#{params[:path]}" : '/')}  

How it works:

If you have an apache/nginx webserver before your app it's better to add an url rewrite rule in your apache/nginx webserver ;)

Upvotes: 3

Related Questions