What is the problem you are trying to solve?
Liferay’s Pattern Redirects feature does not support matching, capturing, or reusing query string parameters in regex-based redirect rules. During our migration of document URLs, we expected to preserve dynamic query parameters and forward them to the target URL using regex matching groups. However, Liferay evaluates only the URL path (friendly URL) and strips query parameters before regex processing. As a result, query string values cannot be captured and reused in the redirect destination.
This limitation prevents us from implementing certain URL migration and legacy URL compatibility scenarios entirely within Liferay’s Redirects application.
What is your project about? (e. g. Intranet, Partner Portal, Enterprise Website, etc)
Enterprise public website serving content and document downloads. The platform uses Liferay DXP Content Management capabilities and relies on redirects to maintain backward compatibility with historical URLs during ongoing content and document structure modernization.
What is your proposed solution? (optional)
Enhance the Pattern Redirects feature to optionally evaluate the complete request URI, including query string parameters, and allow regex capture groups to reference query string content.
Example:
Source request:
/public/documents/manual.pdf?parm1=value1&parm2=value2
Pattern:
^public/documents/([^?]+)(?:\?(.*))?{{responseHTML}}lt;/code>
Target:
/documents/d/myspace/$1?$2
Expected result:
/documents/d/myspace/manual.pdf?parm1=value1&parm2=value2
Alternatively, introduce a configuration option that automatically preserves and appends the original query string during Pattern Redirect processing, similar to the behavior commonly available in reverse proxies such as Nginx or Apache HTTP Server.
This enhancement would simplify URL migration projects, eliminate the need for external proxy-based rewrite rules, and provide a centralized redirect management experience directly within Liferay.