I’ve read other posts about how to potentially do this but am looking for a working solution. I’m also aware I can customize site texts, but that’s not a solution for this use case.
What would you like done?
A way to redirect to one url on page-forbidden, and another url on page-not-found. It can be a plugin, a theme component, some javascript that I paste into admin > customize > theme > custom css/html, or some other solution. I do not want to set up Apache or Nginx. The urls will not change often and can be hard-coded.
When do you need it done?
In the next two weeks.
What is your budget, in $ USD that you can offer for this task?
Open to suggestions.
*** If interested, please PM me. Do not post here saying “I’ll do it”.
Apologies, please post here then. I’ve had cases in the past where someone posted publicly “I’ll do it”, but I didn’t want to hire that person. Other (better) candidates then don’t throw their hat in the ring because the job is taken.
I’ve tried that, but I don’t see any difference. If I go to /foo with it enabled or disabled, I get the same thing. (I’ve customized the text to try to give them a clue why, but that’s not very satisfactory.)
But /foo doesn’t exist, so that’s the right message (you can customize it to say just “does not exist” and remove “not found” as I wrote while you were writing your reply)
You want to change the behavior for page-forbidden. That works as you ask, but since the forum I think this is for is login-required I can’t give an example on your site.
I agree, and I had (mistakenly, as you point out) customized both texts to the same, which isn’t really correct. But I still don’t think I can make it do what I want. Some more detail about the use case:
We have several categories that have special access requirements. Examples:
To see category X you have to fill in an NDA form which puts you in group-x.
To see category Y, you have to accept a Discourse policy, which puts you in group-y.
To see category Z, you have to jump through some other hoop, which puts you in group-z.
We have a certain post “How to join a forum subgroup” that explains all these rules and has links to the forms.
Sometimes a user gets a topic link from another user, but is not able to access it, perhaps because they have not signed an NDA. Discourse takes them to a Forbidden page, but does not explain how they can get access (i.e. which of the hoops they need to jump through). I’ve customized the text to try to point them to “How to join a forum subgroup” but the result is not very satisfactory. (See screenshot above.)
I can see two approaches:
On forbidden, redirect them to “How to join a forum subgroup”, and let them read all the rules and hopefully deduce which hoop they need to jump through to see the desired topic.
It would be much better if we could say explicitly “You are not allowed to see that topic because you need to sign this NDA”. That would require a config that maps categories to posts, e.g. category X → post with NDA form. There are 15-20 of those rules/mappings.