# 如何查找路由或使用包含动态字段的相对URL

**URL:** <https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252>\
**Category:** Product Support\
**Created:** [2021 年11 月 4 日 14:37 UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252 "2021-11-04T14:37:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

作者： ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
发布日期： [2021 年11 月 4 日 14:51 UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/2 "2021-11-04T14:51:44Z")

</div>

> [@Mr.X\_Mr.X](#):
>
> 当 URL 中包含用户名（或其他动态文本，如组名）时，如何使用相对 URL？例如在偏好设置面板中的 URL。

这个我知道。🙂 你可以将 `/u/username` 替换为 `my` 以创建通用链接。

例如：

`https://meta.discourse.org/u/jammydodger/preferences/account`

变为

`https://meta.discourse.org/my/preferences/account`

[https://meta.discourse.org/my/preferences/account](https://meta.discourse.org/my/preferences/account)

---

_[View the full topic](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252)._
