MODX Community

Can query parameters be preserved with weblinks?

I have a weblink pointing to another resource in MODX using a format like [[~1234]]. The first page may have arbitrary query parameters in the original URL, as in www.example.com/some/weblink?a=1&b=2. Is there a way to pass those query parameters along to the actual page that the weblink points to (e.g., www.example.com/some/actualpage?a=1&b=2)?

1 Like

This is way outside my area of knowledge, but I suspect you could use a GET query to get the url and then output some/part of it.

But also, what’s making the link, its a search function? It might work to have that tool pass on the url.

Also, just to be clear, you want the url with some query parameters to be…copied into a link on that page? Or you are tying it to an existing page with same parameters?

My thinking is that your actual page will still have the alias/url of `www.example. com/some/actualpage, but you can add I believe some additional values to the visible url in your htaccess. That wouldn’t change the page or anything, so I don’t know why modifying the url makes much sense…

Maybe others will understand better

Try this:
[[~1234? &a=`1` &b=`2`]]

1 and 2 could be set with query parameters quite easy, but if you want to build that totally dynamic, you should write a snippet.

1 Like