Redirects.json not sending parameters in redirect

Hello,

Ghost Version : Latest, updated just before trying redirects
Host : DigitalOcean Droplet

I’ve recently started a project where I need to redirect links from my site to external links, but the redirect does not include the parameters that I am including. Here is my redirects.json :
[ { "from": "/ref/offer-name-here", "to": "https://www.external-site.com/products/product-name-here?ref=reference-name-here", "permanent": true } ]

Anything after the ? does not send. It just sends to the link :
https://www.external-site.com/products/product-name-here

Is there a way to include the reference parameter?

This isn’t possible at the moment because of this outstanding issue:

This appears to have been closed as completed in github. However, this redirect is not working for me:

{
        "from": "\/search?q=([a-z0-9-+]+)",
        "to": "/search/$1/",
        "permanent": true
 }

Any request to /search with a q querystring is redirected to /search/.

NOTE: ‘search’ is used by the tag taxonomy:

taxonomies:
  tag: /search/{slug}/
  author: /author/{slug}/

Have I misread something?

The referenced issue is slightly different from your case.

In the referenced issue:

“I want to redirect /from to /to. When this happens, include all the query parameters - e.g. /from?ref=site should redirect to /to?ref=site

Your issue:

“I want to redirect /from/?ref=site to /to/site

As far as I’m aware the redirects feature only supports URL pathname matching, meaning the query parameter is ignored.

A workaround for this problem would be to make an .hbs file that contains some javascript that does the redirect you want, and then use routes.yaml to make /search go to that .hbs page. Use javascript to get the query parameters and then redirect the user to the correct /search/param page.

Hi,

I’m confused. I made a YAML doc with this in it:

301:
/permanent-redirect-from: /untitled
/permanent-redirect-from-2: /big-tech-not-equal-good-or-safe

It’s not working. What did I do wrong?

The directions given in the tutorial on Ghost.org stink and make no sense.

When using YAML, you’ll need to ensure the formatting is correct. The spacing is essential. Is your file formatted like this?

301:
  /permanent-redirect-from: /untitled
  /permanent-redirect-from-2: /big-tech-not-equal-good-or-safe

And just to be clear… you’re saying in your example at you want to redirect FROM permanent-redirect-from TO untitled. So you have a page/post on your site at {yoursitename}/untitled , right?