Modifying the Redirect String

I have a situation where I want to only use part of the string being redirect. I’m trying to work around a limitation on a web app, where I have a string “ID3014 - Important Requests” and I want to redirect users to a site I don’t control that only accepts the string ID3014 in the URL.

I would love to be able to redirect the user to http://my.netlify.site/go/ID3014%20-%20Important%20Requests and have it redirect to http://www.externalwebsite.com/ids/ID3014.

I know it’s a long shot, but any chance that is possible?

Hi @dveuve ,

It might be possible. It’s generally not recommended to have spaces in your URL so I’m not sure how we will match the spaces, but you can include the encoded version and see if that works with something like this:

/go/ID3014%20-%20Important%20Requests http://www.externalwebsite.com/ids/ID3014 301!

Note that you didn’t specify what kind of redirect you wanted to do, or if you wanted to force it or not so I just used 301!. You can read more about redirects in our docs.

Ah, apologies, I wasn’t quite clear enough. The ID number could be any four digit number. Would I have to create entries in my redirect for all the possibilities? (And if so, would that be performant?)

We recommend less than 1000 redirects on any site for best performance.

A better workflow here would probably be to use a single-page app framework like react (or gatsby which uses react, or vue) and have the router “do the smart thing” with all the URL’s under a path like /go and process clientside rather than setting up thousands of redirects at Netlify.

As Gerald said, it might work, or it might not, and the spaces would likely be a problem too for our redirects, so probably better to find another path for this workflow.