Handle external urls in topic body for subfolder installation

Hi, we have a forum installed in subfolder, https://www.cuba-platform.com/discuss . The main website has a store located at https://www.cuba-platform.com/store . I would like to share this link in some topic or post of our forum. But Discourse handles this URL as internal, it adds /discuss to the URL: https://www.cuba-platform.com/discuss/store when I click the link in composed message.

The workaround I found - to use a link without www. But I would like to have a permanent solution, because users may publish any external links pointed to our website/old forum and those links will be always dead, and users do not know about the workaround.

1 Like

Your solution is a pretty good one. Your only other option, I believe, is a custom plugin that adds a route for that address and redirects to the external (to Discourse) server.

You can do this by defining permalinks in admin. In my example, my subfolder is /forum:

I’m not sure if both are necessary, but I created them to be sure.


Of course! I thought that I’d remembered that permalinks didn’t work this way, but maybe it was that permalink normalizations work only for permalinks.

Thank you, guys, but I assume this is a bug. The forum installed in a subfolder should not change any urls typed manually. I hope this information will help to detect a problem and fix it.

Here it is an example:


You may see, that the link points to the path out of the forum, let’s say ‘external url’ (for mind, my forum is located at https://www.cuba-platform.com/discuss).

The poster expects that anybody can follow the link later, as he(she) see on the screen - https://www.cuba-platform.com/store.

But actually forum redirects to another address https://www.cuba-platform.com/discuss/store which does not exist. This is because the forum has been installed in subfolder /discuss. I am sure that forum settings are correct :wink:. For that reason nobody knows how many cases with external links exist, and how many permanent rules should be predefined in the forum settings. The same problem is to have a plugin/php-script to handle such links.

As I remember, almost all external links posted by users were redirected to inexistent forum addresses, though those links were not located in forum. Users even cannot share a link to download page https://www.cuba-platform.com/download

I already have reported the same subfolder issues. Let me post it again, because here is a right place for them, I think. I filled some settings fields with custom values (terms of use, privacy policy etc) and tried to access them:

  1. Go to https://www.cuba-platform.com/discuss/guidelines
  2. Left click https://www.cuba-platform.com/terms-of-use - redirects to wrong location.
  3. Go back to guidelines.
  4. Left click https://www.cuba-platform.com/privacy-policy - redirects to wrong location.
  5. Return to guidelines.
  6. Left click https://www.cuba-platform.com/faq - redirects to correct location.
  7. Open browser console and click Back button (go back). It will show unstoppable redirect.

P.S. Currently I found that if I middle click the link (aka open the link in the new tab, Firefox) it opens the correct url! :slightly_smiling_face:

You can call it that. The permalink solution is the solution to your problem.

Hi, guys!

We have forum installed in subfolder: https://i.materialise.com/forum/
It seems I have similar problem with external links. When user clicks on external link, he gets redirect to our domain with path and query string from original url.
For example:
instead of

Open in new tab menu and middle button click works well.

Please advise, how to solve this.


Unfortunately it does not work for me.
I waited for 1.9.0 release to perform tests on stable version. I added both lines without no success.

Here it is a list of static links from main page of our website, all of them broken.

When the user posts similar links in our forum, those links become dead.

Could anybody reproduce this bug?

p.s. I found weird google stats, some URLs return different codes:

  1. 200 for anonyms;
  2. redirect 301 to privacy-policy page for logged users;
  3. 403 for Google bot
    example urls:

I have a live demo of it working for me here using the above example.


I am sorry, that was my fault. I used www in permalinks earlier. It works without www now. Probably the problem with www is on my side, I will investigate it later. Thanks!

@neil, I have created a topic, where you may check the broken url, it will show 404:


this is still a bug, yesterday checked on v2.0.0.beta10 +117. No chance to fix it by permalinks. It is really painful, because for each posted link I need to create a permalink.

For example, i can create a permalink for https://www.cuba-platform.com/development, but I have to do the same for:

Moreover, first time the link is always broken until someone reports that it is broken :persevere:. I even tried to use Saved searches to catch possible broken URLs, this made me a happy zombie-watcher :zombie:.

Please fix it for subfolder installation…

You should rethink your commitment to subfolder sharing in this manner. It’s going to be painful, forever.

I strongly recommend



1 Like

Ok, let it be a solution in this quest :slight_smile:. In my case I am not sure that we can move to subdomain, because we are strong :muscle: )). Anyway this point may be useful for others who will surf this forum researching subfolder installation tips and tricks!

Thank you for your attention to all questions, very appreciated, @codinghorror!

The problem is we have virtually no customers running this way and we always recommend against it. Furthermore the way you have


Next to


is even more odd … which means this is super rare in the wild. It also does not make sense for us to prioritize any fixes here because none of our customers benefit.

1 Like

Ok, no problem. I realize that we chose our own problem with a subfolder installation, but now it is not reasonable to change it at all. I just used to think that it is possible to resolve this in some regexp in forum code.

You could try permalink normalization site setting. It’s designed to solve a problem that is at least similar.

This topic was automatically closed after 2378 days. New replies are no longer allowed.