# Admin link in subfolder mode is incorrect

**URL:** https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920
**Category:** Bug
**Created:** [October 27, 2017, 1:51pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920 "2017-10-27T13:51:31Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![nadiasvertex](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadiasvertex/32/81210_2.png) [@nadiasvertex](https://meta.discourse.org/u/nadiasvertex)
#### Post date: [October 27, 2017, 1:51pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/1 "2017-10-27T13:51:31Z")

</div>

When I grant admin access, the link that gets sent in the e-mail is incorrect. Instead of being:

[http://mysite/forum/path/to\_confirm](http://mysite/forum/path/to_confirm)

it is:

[http://mysite/path/to\_confirm](http://mysite/path/to_confirm)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 27, 2017, 5:29pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/2 "2017-10-27T17:29:41Z")

</div>

This might be a valid sub folder bug @neil?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [October 27, 2017, 8:26pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/3 "2017-10-27T20:26:14Z")

</div>

Yes, the code is [explicitly using the no-subfolder URL](https://github.com/discourse/discourse/blob/master/app/mailers/admin_confirmation_mailer.rb#L11): `base_url_no_prefix` 🤨 I’ll fix.

EDIT: fixed

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [October 28, 2017, 4:44am UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/4 "2017-10-28T04:44:57Z")

</div>

Possible the same problems:

1. on badges notifications - incorrect url
2. on FAQ button - it returns wrong location, so it’s not possible to return from FAQ url back to the forum.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [October 30, 2017, 4:56am UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/5 "2017-10-30T04:56:38Z")

</div>

1. “ **click here** to unsubscribe” in digest email is incorrect too.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [October 30, 2017, 6:36pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/6 "2017-10-30T18:36:54Z")

</div>

Thanks @Ivan_Rapekas. I fixed the unsubscribe link in digest email, and found that the “About” link was wrong here:

 ![48 PM](https://global.discourse-cdn.com/meta/original/3X/2/6/26b6dc05b104e6baa56b029e96d1d5d293f56457.png)

But the FAQ one is correct there and in hamburger menu. Where did you find the FAQ button with the wrong url?

> [@Ivan\_Rapekas](#):
>
> on badges notifications - incorrect url

This is an example of hard-coded URLs in our translation files, which is something we need to stop doing.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [October 31, 2017, 7:00am UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/7 "2017-10-31T07:00:12Z")

</div>

Hi @neil , thank you for the fast reply and actions!  
I found that emails may contain wrong url or not, it depends on the kind of notification. For example:

1. email with `[forum name] Summary` in the subject has `incorrect` URL
2. email with `[forum name] [category] topic name` in the subject has `correct` URL
3. email with `[forum name] [PM] Backup completed ...` in the subject has `correct` URL
4. email with `[forum name] [PM] Data export ...` in the subject has `correct` URL

I meant FAQ button from the menu, but the same problem can be reproduced in the /about section.

My forum works in the folder `/discuss`. I set external URLs for all buttons here: \<base\_url\>/discuss/about

 ![изображение](https://global.discourse-cdn.com/meta/original/3X/4/1/416cacdd60e910548c7f9aa17113bf8faae6164f.png)

1. If I click FAQ link, it redirects me to \<some\_external\_url\>. When I click ‘Back’ button in the browser, get endless 302 redirect. When I click ‘Back’ button again, it returns me to forum as I expected in the previous step.
2. If I left-mouse click Terms of Service link from the picture above the first time, it redirects me to correctly to \<external\_tos\_url\>
3. But when I click to Guidelines first and then to TOS link, it redirects me to /discuss/terms-of-use page,which does not exist in my case.
4. Privace section has the same problem. In other words, it’s unable to access TOS and Privacy from Guidelines page.

Sorry for my Joda-style english 🙂

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [October 31, 2017, 7:31am UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/8 "2017-10-31T07:31:26Z")

</div>

Wrong URL in badge, missed folder:

> **Summary**
>
> ![изображение](https://global.discourse-cdn.com/meta/original/3X/2/b/2bcd3b0c0c03ca4b9a95ba1fb026bef2105af74a.png)

> **Summary**
>
> ![изображение](https://global.discourse-cdn.com/meta/original/3X/7/8/788336d0df114d7e14a25daff9c13cea01b40b90.png)

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [October 31, 2017, 6:27pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/9 "2017-10-31T18:27:45Z")

</div>

> [@Ivan\_Rapekas](#):
>
> email with [forum name] Summary in the subject has incorrect URL

Which url in the email is incorrect?

About the other problem, I can see it happening on your site but can’t reproduce it unfortunately.

I’ll fix some of the other links.

Another subfolder bug: All links starting with `/my` are broken in subfolder.

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/url.js.es6#L195-L196](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/url.js.es6#L195-L196)

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [November 1, 2017, 6:34am UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/10 "2017-11-01T06:34:44Z")

</div>

> [@neil](#):
>
> Which url in the email is incorrect?

Here it is:

 ![изображение](https://global.discourse-cdn.com/meta/original/3X/7/4/7482b010faea1f0cd6ecffb3b3c26a72a08ec50a.png)

Currently I resolve this using .htaccess rules.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [November 1, 2017, 12:19pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/11 "2017-11-01T12:19:47Z")

</div>

Hi, there is another issue with subfolder.

My website is located at [https://www.example.com](https://www.example.com)  
The forum is located at [https://www.example.com/discuss](https://www.example.com/discuss)

I made a custom html header in the default theme:  
`<a href="https://www.example.com/faq">FAQ</a>`

When I click the link in my header, it redirects me to  
`https://www.example.com/discuss/faq` instead of `https://www.example.com/faq`

It seems, that Discourse handles external links in custom header as part of forum.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [November 1, 2017, 2:45pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/12 "2017-11-01T14:45:46Z")

</div>

> [@neil](#):
>
> I fixed the unsubscribe link in digest email,

I fixed that unsubscribe link.

For your custom html header, you’re using a route that the exists in the Discourse app, so the javascript is handling it. Maybe adding `target='_blank'` to that link would work, or change it to a path that’s different that one of Discourse’s routes.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [November 1, 2017, 2:58pm UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/13 "2017-11-01T14:58:34Z")

</div>

But, shouldn’t Discourse detect only route changes for [https://www.example.com/discuss/](https://www.example.com/discuss/) paths? Why does it react on changes with [https://www.example.com/](https://www.example.com/) prefix ?

The same problem persists for all our menus, including, for instance, [https://www.example.com/case-studies](https://www.example.com/case-studies) that does not exist in discourse as a route. In this case Discourse opens [https://www.example.com/discuss/case-studies](https://www.example.com/discuss/case-studies) on click by link and shows 404 Page “Oops! That page doesn’t exist or is private”.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 9, 2018, 9:22am UTC](https://meta.discourse.org/t/admin-link-in-subfolder-mode-is-incorrect/72920/14 "2018-07-09T09:22:45Z")

</div>


