Make forum available on a subpath via additional route


I’m trying to reroute the forum from the root path / to a subpath (i.e. /forum) in order to show another page at the root path.

For now, I just want be able to show the forum at /forum. I do not want to install Discourse on that subpath, though.

First of all, via a plugin, I add the following route:

Discourse::Application.routes.append do
  get '/forum' => 'list#latest'

Next, I tried to add a fitting route to app-route-map.js.es6#L18, replacing the following

this.route('discovery', { path: '/', resetNamespace: true }, // …


this.route('discovery', { path: '/forum', resetNamespace: true }, // …

So far, this is not working as I’d hoped. In particular, the first Ember transition is from '' to discovery.index whereas a regular installation will transition from '' to discovery.latest.

Can anyone offer some help as to what I’ve missed or misunderstood?

I’m aware that this might be an unusual request.

Update, June 8th, 18:27: The following works when going to /forum/latest:


Discourse::Application.routes.append do
  get '/forum/latest' => 'list#latest'


this.route('discovery', { path: '/forum', resetNamespace: true }, // …

Now, how would I set things up to be able to open /forum with the same result?

Update, June 8th, 20:09: Additionally, the following changes need to be made to have the navigation bar links work under the subpath:

  • app/assets/javascripts/discourse/models/nav-item.js.es6:
    Change Discourse.getURL("/") to Discourse.getURL("/forum/").
  • app/assets/javascripts/select-kit/components/category-drop.js.es6:
    Change Discourse.getURL("/c/") to Discourse.getURL("/forum/c/").

Probably, other similar changes need to be made to.


a simpler solution is to put a nginx as reverse proxy in front of Discourse.
this was discussed before here.


I don’t see how this would allow me to achieve my goal. I want to use Discourse on /, just not with a view of the forum.

To make things more clear, maybe: I don’t want to replace the landing page with a completely static page. The whole header can stay where it is, but underneath it, I want to display an arbitrary page. How exactly, I will figure out later. But if that is supposed to work, I need to make sure that the forum is available and working properly on a different path first. Sorry if that sounds too adventurous. :sweat_smile:

(Mittineague) #4

It doesn’t sound too adventurous, but it does sound a bit vague.

What “arbitrary” page? A custom “home” page that isn’t static? A random topic, random category, the FAQ, … ???

Can you provide a URL to site that is doing this as an example?


It is vague on purpose. I want to be able to display any kind of page (e.g. a static page, some web application). It’s not Discourse-specific, but Discourse should be part of that website or web application. To avoid breaking the forum, I tried to move it out of the way first while maintaining its features (e.g. navigation bar links, etc.).

Maybe it is possible to leave Discourse’s routes untouched completely (i.e. not moving the forum out of the way) while still showing a different homepage by specifying a route in the plugin. I just thought the approach to separate these concerns is logical.