ExpressionEngine icon indicating copy to clipboard operation
ExpressionEngine copied to clipboard

Add ability to forward URL parameters with template redirect tag

Open swierczek opened this issue 1 year ago • 1 comments

This will add a setting and functionality to optionally forward URL parameters when the {redirect=''} tag is called in a template.

New setting in Settings > Debugging & Output:

image

Additionally, $config['redirect_forward_url_parameters'] = 'y'; (or 'n') can be added to config.php to control this behavior instead of toggling it in the CP.

To test this, create a new template like redirect.group/index.html with only {redirect='/'} (or add a redirect tag to an existing template if that's easier).

With the new setting turned off, go to /redirect?utm_test=thing in the browser, and you should land on the homepage without the URL parameters. Note the GET URL and the Location URL:

image

With the new setting turned on, go to /redirect?utm_test=thing again, and you should land on the homepage with ?utm_test=thing appended. Note the GET URL and the Location URL:

image

swierczek avatar Jan 26 '24 18:01 swierczek

@matthewjohns0n we need a review here, with some accent on security audit

intoeetive avatar Feb 19 '24 11:02 intoeetive