在SilverStripe中,我们可以为会员个人资料创建虚拟URL吗?

huangapple go评论95阅读模式
英文:

In silverstripe Can we create Vanity URL for the member profile?

问题

在SilverStripe中,我们是否可以为会员个人资料创建类似"mydomain.com/john-doe"的虚拟URL?

我尝试通过routes.yml来实现,但这会破坏其他URL,如管理页面和其他前端页面(关于我们)。

英文:

In silverstripe Can we create Vanity URL for the member profile like "mydomain.com/john-doe"?

I tried to do it via the routes.yml but it is breaking the other URLs like admin and other frontend pages(about us).

答案1

得分: 1

Yes, though there's no simple yaml configuration for doing so.
The easiest way to do this is probably with the silverstripe/redirectedurls module which gives you a section in the CMS for setting arbitrary URL redirections.

If that doesn't quite do what you're after, you could set up VirtualPages for each such page - though that will clutter your sitetree somewhat (which you could alleviate by hiding those from the sitetree and setting up a custom ModelAdmin for managing them).

英文:

Yes, though there's no simple yaml configuration for doing so.
The easiest way to do this is probably with the silverstripe/redirectedurls module which gives you a section in the CMS for setting arbitrary URL redirections.

If that doesn't quite do what you're after, you could set up VirtualPages for each such page - though that will clutter your sitetree somewhat (which you could alleviate by hiding those from the sitetree and setting up a custom ModelAdmin for managing them).

huangapple
  • 本文由 发表于 2023年3月15日 20:51:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744967.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定