I followed this tutorial. but now, instead of example.com/forum/, my discourse is shown in forum.example.com/forum/
what could be wrong?
AI-generated summary
The discussion revolves around hosting Discourse in a subfolder. hnaseri experienced an issue with their Discourse installation being accessible at forum.example.com/forum instead of example.com/forum. pfaffman advised changing the DISCOURSE_HOSTNAME in app.yml from forum.example.com to example.com.
However, hnaseri noted that they needed to use a subfolder due to hosting their website and forum on the same server. hnaseri eventually decided to follow pfaffman’s advice to avoid complications.
Another user, sanjaynava, encountered a different issue while trying to set up Discourse in a subfolder. They experienced a 503 error after changing the DISCOURSE_HOSTNAME to www.example.com and routing www.example.com/forum to forum.example.com through Fastly. pfaffman suggested that the container might be misconfigured. After rebuilding the app, sanjaynava was still unable to access the forum at the desired URL. pfaffman concluded that the reverse proxy configuration was incorrect.
My advice
Don’t waste your time with a complicated configuration that buys you nothing but headaches.
But Mom always says that unsolicited advice is worth what you pay for it.
The answer to your question
See the line in app.yml that looks like this:
DISCOURSE_HOSTNAME: 'forum.example.com'
and change it to this:
DISCOURSE_HOSTNAME: 'example.com'
wow thank you very much for solving me the problem and also that SEO advice. However I believe that google is all about user experience. And yes theoretically sub-domains and sub-folders don’t have any difference in terms of seo. However from a user experience point of view, I believe that sub-folder is better.
Did my answer to your question work for you?
I think the answer is logical but I’ve not tested it yet.
I think I’m going to stick with your advice because things are much more complicated than what I was thinking! I use the same server to host my website and the forum, so I need to follow this guide, and even worst, the control panel of the server is VestaCP
.
I’ve followed the official discourse sub domain guide for subfolder and I’m routing subfolder www.example.com/forum to discourse forum forum.example.com through fastly. I also changed the discourse hostname to DISCOURSE_HOSTNAME: 'www.example.com' now www.example.com/forum shows Error 503 Backend unavailable, is there anything need to change in DNS ?
That 503 suggests that your container isn’t running or is misconfigured.
If I change hostname back to forum.example.com it works fine but my forum show up on forum.example.com/forum. Is there anything need to change to show up forum on main domain sub folder www.example.com/forum ?
Did you ./launcher rebuild app?
yes, I did ./launcher rebuild app after hostname change. and rebuild was successful.
Then whatever you configured to reverse proxy isn’t configured correctly.
I’m following this guide to setup proxy through fastly.