How to get relative URL from current URL

Viewed 524

I am new with Shopware 6 and its template engine Twig, but I need relative URL from current URL in theme. The problem is that almost all data in database are binary, so if I use:

{{ app.request.pathInfo }} or {{ app.request.requesturi }}

I always get such output:

/detail/eccbc87e4b5ce2fe28308fd9f2a7baf3

but the current URL in browser is a search friendly URL.

With: {{ seoUrl('frontend.detail.page', { productId: page.product.id }) }} I get the absolute URL in a search friendly format, but every try to replace host and scheme fails and I get an error. I can only replace /, detail or eccbc87e4b5ce2fe28308fd9f2a7baf3, but not host and not scheme.

Does anybody know what to do to get relative URL?

1 Answers

Solution: {{ app.request.attributes.get('sw-original-request-uri') }}

Related