I currently try to implement FedSocnet compatibility for my site and according to Bridgy Fed I need to redirect 4 URLs “with query parameters”. According to the Netlify redirect docs I need to exactly specify the parameters. Is there a way around this?
Since new users can only put 2 links in posts, I’ve to modify the rules below to meet the forum requirements.
These URLs should be redirected with Query Parameters
/.well-known/host-meta
/.well-known/host-meta.xrd
/.well-known/host-meta.jrd
/.well-known/webfinger
The redirection examples for Apache look like:
RewriteEngine on
RewriteBase /
RewriteRule ^.well-known/(host-meta|webfinger).* hxxps://fed.brid.gy/$0 [redirect=302,last]
and for nginx
rewrite ^/.well-known/(host-meta|webfinger).* hxxps://fed.brid.gy$request_uri redirect;
What I tried so far:
/.well-known/* hxxps://fed.brid.gy/.well-known/:splat 200
/.well-known/host-meta* hxxps://fed.brid.gy/.well-known/host-meta* 200
/.well-known/webfinger* hxxps://fed.brid.gy/.well-known/webfinger* 200
Just to confirm I’m understanding correctly, by “specify all possible combinations of query params” do you mean we need to specify all combinations, including when params are optional?
For example if we need UTM tags to persist after a redirect dependent on language, and are using utm_source, utm_medium and utm_campaign would this be the correct configuration?
Are these necessary or will the first rule do the trick? And if they are needed, is there a less verbose way of doing this? Things will get pretty crazy pretty fast with more languages and more query params
Hi, @jhs, you are correct that all combinations are required. This is covered in our documentation here.
Quoting:
Query string parameters are not automatically passed to our redirect engine. To use query parameters in redirects, you must specify rules with the exact set of parameters you are expecting.
If you have multiple parameters, some of which are optional, this is the pattern to follow to ensure that we are prepared to handle all possibilities. Note that the “most general” redirect is after the more specific ones:
So, yes, you do need all combinations to include the parameters when redirecting.
Please let us know if there are other questions about this.