11

I am interested in having a blog on my site which will be in a subdirectory of the main wordpress homepage

e.g. website.com/blog

however, I am interested to know if there is a way to host the blog on a separate server - primarily because I don't want to overload the server for the rest of the site if there is a lot of traffic going to the blog. I am keen on the idea of it being a subdirectory though.

Anyway - just thought there would be someone smarter than me who might have a bright idea :)

2
  • 1
    so you want two separate wordpress installations hosted on two separate servers but you want the URLs for website.com/blog to redirect to wherever the other site is hosted? Depending on your host that should be possible and there would be more than one way of doing it, but it isn't really a wordpress question at that point since each wordpress installation would be rather straightforward. Commented Jul 23, 2014 at 16:49
  • 1
    You can have multiple servers but with the same content, so when one server fails, the content is taken from the other server. It is possible balance loading hardware, that is what determines which server will respond to the requests. But I'm not sure if it's possible with different content.
    – Unix
    Commented Jul 23, 2014 at 17:01

4 Answers 4

7

A reverse proxy could work, such as varnish or nginx. Using varnish as an example:

backend blog {
   .host = "blog-server-ip";
}

backend default {
   .host = "current-domain-ip";
}

sub vcl_recv {
   if (req.rul ~ "^/blog/") {
      req.backend = blog;
   }
}
3

There are multiple additional approaches available today:

2
2

A better way to to do this is to instead of a subdirectory, use a subdomain like blog.website.com. The reason for this is that a DNS record can be made to the other server for the subdomain, which is not possible with subdirectories.

A subdirectory is possible, but you would have to use frames, a .htaccess redirect or another way which is totally not stable in a production environment.

If you want to use a subdirectory like example.com/blog, the best way (and it's not a good way...) is to use an .htaccess file. You can make a redirect like this: Redirect 301 <server IP> where server IP stands for the IP address of the server you want to host your blog on. Note that the user will see the IP address in the address bar which is not recommendable.

Therefore, you might also want to give frames a try. Use iFrames, frames are outdated and no-one will recommend to use them. Note that iFrames or frames aren't a good solution either, but if you really want to use a subdirectory this is what you'll have to do... create an index file (e.g. website.com/blog), and place <iframe src="<server IP>"></iframe> there.

Note that also this is no good solution and I really recommend using a subdomain.

If you want to use a subdomain like blog.website.com, go to a place where you can manage your domain's DNS and add a an A record which points to the IP of the server you are going to host your blog on.

Edit: this is off-topic, but worth mentioning: if you don't want an overload on your server, instead of having multiple servers, you can set up cluster hosting. This is a very handy technique, especially for websites that have many traffic. The concept is to spread the load of hosting across multiple servers. Here's the Wikipedia article about clustered hosting - I recommend reading it. There are multiple hosting providers that offer cluster hosting. Unfortunately I only know Dutch hosting providers that offer clustered hosting, so I can't recommend one. The cheapest I know in The Netherlands is about €100,- per year, so clustered hosting is quite affordable.

Good luck!

3
  • Hey thanks for the response. Give me some clear direction. Whist from a users perspective I would rather take the route of a sub-directory, it sounds like either an old school iframe might be the way to go or bite the bullet and go for a subdomain. I guess SEO performance comes in to play there. But yeah thanks so much for your summary!
    – Joji Mori
    Commented Jul 24, 2014 at 0:28
  • @JojiMori No problem! :) Also take a look at what I wrote about clustered hosting, this may be the way to go without having to invest in a new server ^
    – William
    Commented Jul 24, 2014 at 7:18
  • 5
    Subdomain is bad for SEO. See moz.com/learn/seo/domain
    – Victor
    Commented Nov 24, 2016 at 8:00
-1

Does it have to be website.com/blog?

A faster solution and less complex would be to just host the blog as blog.website.com

For website.com/blog, your best solution is to employ URL Redirects..

see:

https://serverfault.com/questions/567476/permanently-redirect-subfolder-blog-to-subdomain-on-another-server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.