How to redirect /categories to /latest


I would like to redirect /categories to /latest

I’m guessing I should be making some changes to the app.yml file

(Jay Pfaffman) #2

So you don’t want people to be able to get a list of categories?

Perhaps you want to change the home page to /latest?

App.yml won’t do it.


@nixie there is multiple ways of setting this by the discourse itself (default)

One way is of setting for your personal account at;

Default Home page


And put your TOP MENU to latest first in line (it will automatically open latest evereytime)

Otherway my guess would be with (Should inform more about this I didnt test it out) - to force nginx redirect;

 server {
        listen 80; listen [::]:80;
        return 301$request_uri;

(Angus McLeod) #5

If you literally want to redirect /categories to /latest:

withPluginApi(0.8.12, api => {
   api.modifyClass('route:discovery-categories', {
      redirect() {

Untested, but it should work fine.


Yes, I actually want to redirect all users who are accessing the /categories URL to /latest

I have removed /categories from my homepage already.
But in Google, its indexed, and I’m getting traffic to /categories from Google.

That is why I’m thinking about redirecting all users accessing URL /categories to /latest

Where should I add the code that you supplied?

Adding it in /head gives me this message at the top of the page

(Michael Friedrich) #7

I would do that in Nginx to be honest. This also allows for further analysis with the stats plugin, e.g. to see how many of these redirects are coming in, on a daily basis inside the staff category.

(Felix Freiberger) #8

Note that doing the redirect in Nginx will not work for links within Discourse.

(Jay Pfaffman) #9

If the problem is incoming links from search engines, then the nginx solution may be exactly the solution. This directs incoming traffic to the desired place, but doesn’t require changes to disburse. Keeping users from the categories page seems like a bad idea to me.

(Angus McLeod) #10

In site customisations

But if your problem is only links in search, I would agree with @pfaffman.

…apart the typo :slight_smile:

“‘Disburse’, it’s payments 2.0. Now with @mentions and realtime notifications.”

(Jay Pfaffman) #11

Nice work, @angus! I should learn that I can’t type on my phone. @codinghorror has saved me from much embarrassment with his behind the scene sites. @jomaxro too has brought many such examples to my attention. I’d guess that he can now just fix them, when they are at all ineligible.