Need a working solution to redirect on page-forbidden and page-not-found

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”.

FYI this is discouraged here on Meta.

People are encouraged to first publicly reply to topics in Marketplace if they are interested in taking on the work.

There is historical discussion on this here:

5 Likes

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.

1 Like

Maybe you just want the detailed 404 site setting?

That does stuff like

  • Oops! This topic has been deleted and is no longer available.
  • Oops! That page is private.
  • Oops! That page doesn’t exist or is private. (that one didn’t exist–I think you might want to change the text to remove the “or is private” part)
4 Likes

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.

image

image

You’d need to change the text for this one to just “That page doesn’t exist” since it’s written for the default value of the setting.

1 Like

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:

  1. 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.
  2. 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 Xpost with NDA form. There are 15-20 of those rules/mappings.

There’s already this:

which also appears to solve your desired case.

I’ll send a PM with an offer.

4 Likes