Drupal Internalurl重写

发布于 2025-01-30 14:43:16 字数 281 浏览 2 评论 0原文

我正在尝试做一些非常简单的事情,但似乎找不到一种方法。我想要的是以/en/en/products/consectories+软件内部路由到/en/products?附件+软件内部路由。

/en/products是现有页面,无论是在基本上是过滤器的,它们都附加到URL上,因此可以直接链接。现在,它可以通过将其作为查询参数附加起来,但是使用/fillters是首选。但这当然会导致404误差。

站点正在运行D9。

I am trying to do something very simple, but can't seem to find a way to do it. What I want is to have a URL in the form of /en/products/accessories+software internally route to /en/products?accessories+software.

/en/products is an existing page, whatever comes after are basically filters, which are appended to the URL so they can be linked directly. Now it works by appending it as query parameters, but using /filtersHere would be preferred. But this of course results in a 404 error.

Site is running D9.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆悲凉 2025-02-06 14:43:16

为什么不使用Drupal的路由系统并在URL上进行动态论点?

在Module.Routing.yml中,下面的事情应该做:

module.mypath:
  # Dynamic arguments enclosed in { }.
  path: '/book/export/{type}/{node}'
  defaults:
    _controller: '\Drupal\module\Controller\MyController::index'

官方文档中可用的更多详细信息:
drupal-路线的结构

Why not use Drupal's Routing system and make dynamic arguments on URL?

In the module.routing.yml, something like below should do:

module.mypath:
  # Dynamic arguments enclosed in { }.
  path: '/book/export/{type}/{node}'
  defaults:
    _controller: '\Drupal\module\Controller\MyController::index'

More details available in the official doc:
Drupal - Structure of routes

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文