Last update breaks permalink for categories

With the last update the permalink to category is broken, permalinks for topics are working fine.
For example: category/11562 redirects to c/11562 which is incorrect, the redirect which is correctly set as destination should be c/general/4 or c/4
Could anybody help with this problem?

You created a permalink for category/11562 that used to redirect to general, but now it’s broken?

1 Like

Which update branch is that from?

Correct, it used to work fine. Then, I updated to:

<meta name="generator" content="Discourse 3.3.0.beta1-dev - version 0bb492c6b6b79389a12b277b9d25b99e75f2625d">

Completly clean the DB to re-import some other forum data from scratch, and now is not working.

I think this is the problem, because I cannot repro this on tests passed as of this morning.

Can you see if the permalink is still there in your database and if it still points to the right place?


I added the permalinks again with the new import, it is done by the import script. But I also tried to add by hand using the web. Please, find attached a screenshot of the web and the results from DB. Maybe I’m missing something:

Sorry, only one screenshot per post was allowed

Your permalink is not at /category/11562 but at /forum/category/11562.

My quick guess is that you lost your permalink normalizations along the way.


I do not understand if I check the response to

I receive a 302 with Location:

Whereas for topics for example:

I receive a 301 with Location:

I expect Discourse to manage both equally, and as you can see both retain the segment /forum/

1 Like

So you didn’t mention the fact that your entire forum is a subfolder install.


So I dug in a bit deeper and I don’t understand how this could have ever worked, since category/ will always trigger the categories#redirect route, and this did not recently change.

get "category/*path" => "categories#redirect"

EDIT the post below shows it did use to work

1 Like

Yeah. I can’t begin to wrap my head around how permalinks and permalink_normalizations would work in a subfolder install.

And it’s always been a subfolder install?

And nothing else changed when you re-ran the import script?

It seems most likely that something is different in your script.

Wait. redirects to announcements - Discourse Meta, so . . . no, but there’s a spec that shows permalinks override that /category redirect and it’s 4-5 years old.

So I think I would create some category redirects by hand next to figure out what is going on (like /category/mycategory or other thing that doesn’t even have numbers in it)


Good find @pfaffman , that test means that it should have worked indeed.

1 Like

Wow, didn’t even know that was possible!

Yes, it’s pretty neat, see Serve Discourse from a subfolder (path prefix) instead of a subdomain


Thanks for all your answers!

Interestingly, we found out that permalinks for categories work from subfolder only if there is no path named /category/ in the origin url. As @pfaffman mention in his answer. For example, /forum/category_foo/123 redirets correctly to the destination general category.
Discourse captures /category/ and overrides to /c/
Consequently, this can be solved really easy:
add a permalink from /c/11562 which is the redirect from old category/11562 to category General /c/4.

And you were right, the first installation was without subfolder, but the 2nd had the subfolder, this is the 3rd. And we tested, and I believe it was working the first 2 times. The only thing that changed between 2nd and 3rd is that we did not clean the db between 1st and 2nd, and for the 3rd it was a clean install with a new db outside the docker (beside upgrade to Discourse v3). So I suspect something has changed in Discourse v3 beta. Otherwise, why it has ever worked, even without subfolder?

1 Like

Here is your answer

If I understood correct, what you mean is that Discourse only applies the redirect from /category/ to /c/ if there is a segment in the route.

Nonetheless, if I use your forum as an example: and put I get redirected to

Which is the same we experience with our installation, it would be impossible for your site too to get redirected from /category/#old_number to /c/#real_category you would always end up in /c/#old_number