Reputation: 25767
I have an app running on Heroku that use the domain example.com and a blog running on another host, Dreamhost, that uses the domain blog.example.com. For SEO purposes, I want to have the blog appear on example.com/blog. How could I achieve this? My Googling powers have failed me, although it appears that using some Nginx rewrites could be the solution. Any help is appreciated. Since it is for SEO purposes, I simple redirect won't do. I found this solution: How can I use a subdirectory instead of a subdomain?, but is specific to Ruby on Rails.
Upvotes: 2
Views: 492
Reputation: 4346
I am confused with what you are asking though, since Heroku a PaaS platform installing a webserver like nginx is not ease, i am guessing you may be using any nginx heroku buildpack with example.com
pointing to nginx server in heroku, if these are correct then,
creating a reverse proxy in nginx will route sites accessingexample.com/blog
to the address given
server {
server_name example.com;
location /blog/{
proxy_pass blog.example.com; # expect request timeout from example.com -> this server
proxy_set_header Host $host; # or replace with blog.example.com
proxy_pass_request_headers on;
}
}
Upvotes: 2