# Issue with FAQ link on edge case subfolder setup

**URL:** https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798
**Category:** Bug
**Tags:** subfolder
**Created:** [March 3, 2021, 4:26pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798 "2021-03-03T16:26:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [March 3, 2021, 4:26pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798/1 "2021-03-03T16:26:55Z")

</div>

First, this is an edge case **very** specific to my setup, with the `/f` subfolder.

Discourse link on hamburger menu points to `/faq`, without the subfolder, because [`/faq` startsWith `/f`](https://github.com/discourse/discourse/blob/c047640ad4547cef87bf2c2a8326e210d0b276dd/app/assets/javascripts/discourse-common/addon/lib/get-url.js#L19).

Considering this quote:

> [@Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/serve-discourse-from-a-subfolder-path-prefix-instead-of-a-subdomain/30507/1):
>
> Make sure it does _not_ end with a `/`

I guess we could change

```js
  const found = url.startsWith(baseUri);

```

to something like

```js
  const found = url === baseUri || url.startsWith(`${baseUri}/`);

```

So it would match `/f`, `/f/`, `/f/faq`, but not `/faq`, correctly prepending the baseUri to the latter.

Anyway, the route itself also doesn’t work, `/f/faq` returns a 404, so I think there’s similar logic on the router level. I’ve previously noticed that `/f/following` wasn’t working as well (cc @merefield).

Finally, I changed the `faq url` site setting to `/f/guidelines` as a workaround, which fixed the link and the 404, but generated a minor oddity of having both the Guidelines and FAQ terms on the nav bar, both pointing to what’s set on `faq url` (you can check on the [actual page](https://www.comparajogos.com.br/f/guidelines)):

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/7/47ff8606a04774e4ada61f7e20f3aaddb2a43240.png)

Sorry for this kind of kitchen sink topic with 3 issues, but I think they’re so related that it’d be hard to separate them properly.

Thanks.

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [March 3, 2021, 5:14pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798/2 "2021-03-03T17:14:16Z")

</div>

I’ve sent a PR to address the `get-url` issue:

> <https://github.com/discourse/discourse/pull/12284>
>
> Issue was reported on https://meta.discourse.org/t/-/181798
> 
> DEV: test getURL …for urls starting with the prefix without trailing slash
> 
> I tried to avoid more friction so \`withoutPrefix(prefix)\` now returns "/" instead of "", which is consistent to other results – but it can be addressed if needed.

About the 404 on `/f/faq` and `/f/favicon/proxied`, when I CURL these routes inside the container, bypassing Nginx, it works. I was able to fix it by changing the `location` directive described in [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507) from `location /subfolder` to `location /subfolder/`.

The nav bar showing both Guidelines + FAQ is the [expected behavior](https://github.com/discourse/discourse/blob/a0bbc346cb5d5b89d1a3efdfa89869349a8b067f/app/assets/javascripts/discourse/app/templates/about.hbs#L7), it’s unlikely the user will override the `faq url` with the same url.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 4, 2021, 10:21pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798/3 "2021-03-04T22:21:14Z")

</div>

Does mean we are good to close? 🙂 the NGINX issue is fixed with more documentation?

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [March 4, 2021, 10:27pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798/4 "2021-03-04T22:27:36Z")

</div>

Yes, we’re good. I’ve proposed the change on the howto topic.

Thanks.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 4, 2021, 10:28pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798/5 "2021-03-04T22:28:34Z")

</div>

Oh that is a wiki, feel free to edit it! ❤

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 4, 2021, 10:28pm UTC](https://meta.discourse.org/t/issue-with-faq-link-on-edge-case-subfolder-setup/181798/6 "2021-03-04T22:28:38Z")

</div>


