How to run discourse on subdirectory of external domain?

We are moving away from our wordpress website to a cloud hosted e-commerce platform, which will use our bare domain due to our high SEO ranking.

I want to move our posts to discourse, but run it under the same domain is that possible?

To be clear, http://ultraluz.com.br/ will be running in a external server I can’t control or access so I believe I can’t use nginx tricks or something. I only have access to the server that will be running discourse.

My goal is to move posts like this http://ultraluz.com.br/iluminacao-para-esportes-como-deixar-as-instalacoes-esportivas-dignas-de-um-atleta-profissional/ to discourse but keep same path or at best domain/blog/same-url while my bare domain is pointed and hosted in a Wix-like platform.

It might be possible to have cloudflare in front of both sites with a rule to route traffic to discourse for the subfolder. I am not aware of anyone doing that. You’ll probably need to hire someone or figure out out on your own. Just follow the topic here about subfolder installs and whatever cloudflare has about the same.

I thought that the belief that a subfolder was better for seo had gone away. My recommendation would be to just use a subdomain, but if you have a budget contact me or post in #marketplace.

3 Likes

You could technically achieve the subfolder part at Cloudflare using an Enterprise page rule or maybe via workers but I’m pretty skeptical that we could provide any assistance with either.

Cloudflare is hard to support in any form beyond DNS.

And yes, Google themselves have debunked the whole SEO snake oil around cramming everything under a single domain.

6 Likes

Better safe than sorry with SEO. I don’t see how a blog.domain would boost my domain seo, so there is no point in having a blog domain at all.

I’ve been thinking in following this guide. Which assetsPathnames: ["/public/", "/assets/"] I should use?

Subfolder installs are much more complicated and very fragile.

The point is that there’s zero benefit running under the same FQDN and significantly more risk and cost.

3 Likes

That’s what you believe. But there is no evidence that a subdomain helps boost the bare domain at all.

And even cloudflare recommends running everything in the same domain.

Then why, pray tell, is their discourse community on a subdomain?

4 Likes

Because anything with cloudflare in the domain will rank well. And their forum is enormous

If that’s what you believe, move along. There is nothing for you here. Go elsewhere, go somewhere that people believe the same things you do.

7 Likes

I could link much more links, with data behind them if I wasn’t limited to 2 links. And except for Cloudflare, which is massive and don’t need to focus on SEO all websites on the first page for this search use subdirectories

It won’t be hard to find other places where people believe the same thing since this seems to be consensus on the SEO community.

But sure, if you have ANY evidence that a subdomain helps rank the root domain please enlighten the internet :slight_smile:

Direct from Matt Cutts. Your SEO “experts” are selling you snake oil.

Through the years some of the worst, least competent people I’ve ever seen on a team are the “SEO experts”. They are uniformly a disgrace and an embarrassment to the industry.

7 Likes

True! Tons better to do something that most everyone agrees won’t help web rankings but will likely result in your site being down unexpectedly with no clear means to fix it.

6 Likes

Anyone have tried to do this with cloudflare?

As we’ve already explained in your other topic, what you’re asking to do can’t be supported here.

You will either need an Enterprise plan with Cloudflare, or to create custom workers. Either way you should be talking to Cloudflare.

4 Likes

As stated, the answer that I gave earlier, is all you’ll get here.

What I didn’t make clear enough is that it’s a fool’s errand.

For a frame of reference, I’d charge you on the order of $1000 and provide no promise that it would work for for more than a week after I set it up. (or I might charge $500 with no promise that I could figure it out at all.

And you’d need the cloudflare enterprise plan.

If you’re interested, post in #marketplace and include a budget and that you are willing to pay for cloudflare enterprise and understand that it is likely impossible.

2 Likes

I think I’m 80% done in implementing this. I installed discourse on a subdomain as “normal” install.

Then I created a cloudflare worker proxying /blog to my subdomain. It works but chrome refuses to load some stuff because of CSP policy.

Any ideas to go around this anyone? I’ll share my workers code when it’s 100%.

You can go to UltraLuz Blog - Lampadas led to check what is happening.

My idea is that after I fix this, I’ll just use robots.txt to block google from indexing my subdomain, so it only sees and indexes /blog while I can still access the subdomain just fine if needed

2 Likes

This is never going to work really well with a “normal” install, you really should follow the subfolder install procedure. It will fix your CSP issues and many more. Apart from that, I think you’re almost there.

6 Likes

What I should set DISCOURSE_HOSTNAME when using DISCOURSE_RELATIVE_URL_ROOT ? The relative root will be blog for me right?

How does this change stuff related to SSL? This is my env section of yml

env:
  LANG: en_US.UTF-8
  DISCOURSE_RELATIVE_URL_ROOT: /forum

  VIRTUAL_HOST: forum.ultraluz.com.br
  VIRTUAL_PORT: 80
  LETSENCRYPT_HOST: forum.ultraluz.com.br
  LETSENCRYPT_EMAIL: redacted@email.com

  DISCOURSE_HOSTNAME: forum.ultraluz.com.br
  DISCOURSE_DEVELOPER_EMAILS: 'redacted@email.com'

  DISCOURSE_SMTP_ADDRESS: smtp.sendgrid.net
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: apikey
  DISCOURSE_SMTP_PASSWORD: "password"
  DISCOURSE_SMTP_ENABLE_START_TLS: true
  SSL_POLICY: Mozilla-Modern  

The letsencrypt and virtual host stuff is for my nginx docker (jwilder/nginx-proxy) that handles the proxying and ssl creation for me based on that variables…

Also had this but I think it will be fully replaced by the code there?

run:
  - replace:
      filename: /etc/nginx/conf.d/discourse.conf
      from: "types {"
      to: |
        set_real_ip_from 172.18.0.0/24;
        real_ip_header X-Forwarded-For;
        real_ip_recursive on;
        types {
1 Like

Yes, /blog including the slash.

No, just ultraluz.com.br.

I guess you should leave the LetsEncrypt part as it is.

4 Likes

It didn’t work this way. I guess it’s because the worker needs a domain to fetch stuff, and since the root domain is on a different IP.

I’m basically telling the worker "when someone goes to /blog fetch this from rootdomain/blog" this of course just displays my current wordpress 404 error page.

I think because of the whole same domain, multiple IPs/servers things a subdomain is needed to load the discourse assets. But it’s late now and I need to sleep.

But I think the easiest way to achieve this will be to just fix the CSP errors with usual subdomain install.

1 Like