Install to subfolder instead of subdomain (SEO optimization)

(Darren) #1

How feasible would it be to customize Discourse to run in a subdirectory instead of top-level? Subdomains such as are disadvantaged from an SEO perspective.

(Jeff Atwood) #3

Do you have a source for this claim?

Because I don’t think what you say is supported by the actual data.

Using a subfolder might actually hurt you because it makes the site organization too deep:

Despite this organization, Google still sees pages within folders or subdirectories as part of the main domain. That means they are subject to host crowding rules covered above. Generally speaking, Google sees Home of The Domain King®, Rick Schwartz. and Home of The Domain King®, Rick Schwartz. exactly the same, so the choice about which organization to use depends entirely on what’s easiest for you and your users. Using folders tends to make the site easier for you to manage and easier for visitors to understand. However, be careful creating too deep a directory structure. PageRank is thought to flow from the home page into deeper directories and bots crawl from the home page down. Depending on a number of factors (including the PageRank of the site and how frequently the site is updated), bots may only crawl so deeply into a site’s structure. There’s no hard limit on how deeply a site’s directory structure should go, but you likely can’t go wrong with one or two levels.

(Darren) #4

The SEO pros over at SEOMOZ are pretty clear that subdomains do not transfer as much link juice back to the root site as folders.

Furthermore, some internal experiments we’ve run with subdomains vs subfolders have shown that google does not treat the subdomain as being part of the root site.

For example:

(Jeff Atwood) #5

Interesting; were these experiments recent? The cited article is from four years ago. Google has changed how they rank things a lot in the last 4 years.

However, it does make sense that:

are really different sites with their own content, though clearly related, versus say:

Which are more tightly related.

In general, I am not sure you want the discussion area of your site, with 100% user generated content, to be so tightly coupled to your main site if it is highly curated editorial articles.

Discourse does support running in a subfolder, but it is by its very nature a far more complex hosting setup and not to be embarked upon lightly.

(Jeff Atwood) #10

Here’s actual text I got from an email to Matt Cutts today

On the bright side, pretty much everyone who has strong opinions on subdomains vs. subfolders doesn’t know what they’re talking about. They sure do have strong opinions anyway though!

I kind of agree we need to support running in a subfolder for reasons of flexibility, but I am bitter about it since someone who would know better than anyone else in the world says it’s not necessary for Google ranking reasons alone…

Wordpress with Discourse in a subfolder
Problem with discourse in a subfolder
Launch Discourse on In a web folder type
(Darren) #11

Well that’s about as conclusive as it gets, I guess. :slight_smile:

(TheLoneCuber) #12

Hardly @darrennix: that’s one selective sentence “on the bright side of things”. What about the rest of the email @codinghorror? Can you elaborate more? What was the dark side of the subdomain discussion?

(Jeff Atwood) #13

Anyway, this is supported now, running Discourse in a subfolder is supported, but it is a giant PITA (and expensive, as you have to use a forward proxy to redirect the subfolder traffic) if you are being hosted.

If you are hosting Discourse yourself along with all your other websites, it is less challenging.

(TheLoneCuber) #14

I’d love to run off sub-dirs instead of a sub-doms @codinghorror but I’ll settle for the less PITA solution. I’m still interested to know some more details on the Matt Cutts sub-dir email…


@codinghorror can you share more details about why it’s expensive? It’s expensive in terms of processing because you need another webserver in front to redirect traffic?

(Jeff Atwood) #16

It is vastly more complex since you need to route all subfolder traffic to a different server on the Internet. That is kind of unusual. And it requires a forward proxy in front of the website, a rather sophisticated one, with a lot of configuration applied. It is not a simple operation.

(It is somewhat simpler if everything happens to be on the same physical server)


What if, we host discourse at and then a blog at /b/?

This would be much simpler discourse will be untouched, and a reverse proxy in front of a blog should be easy. Also, all the content will be at the same domain. Just and idea.

(Michael - #18

That has always been possible from a technical point of view.
But most people that combine a blog with Discourse, want the blog to show up at the front page.


@codinghorror mentioned Fastly as a forward proxy to send subfolder requests over to your Discourse site, presumably sitting on a beefier server. Fastly is a minimum $50 a month.

(Guillaume Paumier) #20

I’m looking into Discourse and I really like it. My use case for using a subfolder would be to avoid buying an SSL certificate for another subdomain; if I could set up Discourse in a subfolder, I could re-use my site’s existing certificate.

However, reading this thread, I’m starting to see the other advantages of a subdomain install. Also, initiatives like might soon make this argument irrelevant.

(Geneus) #21

Thanks for the clarification @codinghorror. Can steps to install in a subdirectory be added to the installation guide? Or possibly a separate guide as I would imagine the installation process differs quite substantially to the established one?


(Daniel Marquard) #22

I hate to reignite an old thread, but this is one of the top results on Google, and I wanted to throw in my two cents on the matter. It seems like the defense of using subdomains over subdirectories has centered around SEO, but I think a case can be made for subdirectories regardless of SEO.

First, a lack of support for subdirectories seems like a deviation from a longstanding convention. Discourse’s subdomain approach is inconsistent with nearly all other discussion software I’ve worked with in the past.

A big thing for me is branding. At my company, I have our website using no subdomains at all, not even for our CDN, and especially not WWW. All resources branch from the naked domain, something I’d consider to be a best practice, or at least a goal to strive for, for customer-facing websites.

Encryption is another issue, and this does actually speak to SEO. With Discourse installing to a subdomain, most websites would end up needing two certificates or one wildcard certificate; both of which would not be necessary if Discourse installed to a subdirectory.

I’m looking into using Nginx or Varnish to rewrite the URLs in this manner. Not sure where I’ll get with that, but I’m optimistic. Any plans to support subdirectories in the future?

(Rafael dos Santos Silva) #23

Let’s Encrypt made SSL Certs free, so no problem here.

Discourse already supports subfolder.

(Jeff Atwood) #24

We do support subfolder, but the massive increase in hosting complexity (forward proxy, long polling breaks, etc) required for subfolder is rarely if ever warranted by the negligible SEO snake oil benefit.

It is a huge, huge jump in complexity for basically no reason other than “SEO magicks”. If it wasn’t so complex, I wouldn’t care – but it is. And more complex means more error prone, harder to support, harder to troubleshoot, and more costly. We only even offer subfolder hosting on our Enterprise plan and even then it is a paid add-on above and beyond the normal Enterprise hosting rate.