MiG
12 באפריל, 2021, 4:44am
1
So I really love the permalinks feature of Discourse.
For example, I’ve been collecting photos and videos at https://fortmactech.com/riverbreak – which forwards to the longer URL of the actual topic.
The problem I’m running into is that when that’s posted on Facebook and someone clicks it, Facebook appends its fbclid crap at the end. So the URL is something like:
https://fortmactech.com/riverbreak?fbclid=IwAR1E9PoBxuWURZRJlA4D0VrnESbfjGfC2xKuvVJzCRUmIJy7ZRKMkkH8I-U
And it generates a 404 on Discourse.
Is there a trick to getting Discourse to ignore the fbclid parameter?
4 לייקים
MiG
14 באפריל, 2021, 2:51pm
2
So I think this is something that can probably be done with the Permalinks Normalization setting, but I can’t figure out the regex. Basically remove anything after and including ?fbclid= I think.
rmens
14 באפריל, 2021, 3:20pm
3
Interested in this too. This is polluting our Google Analytics data.
2 לייקים
MiG
14 באפריל, 2021, 3:28pm
4
So I’ve been able to solve it with a Cloudflare page rule:
But would rather do it at the discourse level instead.
simon
14 באפריל, 2021, 4:21pm
5
How are you forwarding https://fortmactech.com/riverbreak
to https://fortmactech.com/t/river-drone-videos-photos-2021/818
?
It seems that adding query parameters to the topic URL doesn’t cause any issues. For example, this should work: https://fortmactech.com/t/river-drone-videos-photos-2021/818?fbclid=IwAR1E9PoBxuWURZRJlA4D0VrnESbfjGfC2xKuvVJzCRUmIJy7ZRKMkkH8I-U . So the issue is somehow related to the redirect that’s in place for https://fortmactech.com/riverbreak
.
לייק 1
MiG
14 באפריל, 2021, 4:32pm
6
I’ve sort of solved it now by using Cloudflare. I have turned off the Cloudflare page rule for a while if you want to see the 404 happening.
Try this link as an example:
https://fortmactech.com/riverbreak?fbclid=IwAR1E9PoBxuWURZRJlA4D0VrnESbfjGfC2xKuvVJzCRUmIJy7ZRKMkkH8I-U
I added it like this in admin / settings / permalinks:
This is what it looks like once it’s added:
And the result is this:
I’ve tried with a trailing slash as well.
If I do the Cloudflare Page Rule to remove the fbclid stuff before it hits Discourse, then it works just fine.
Is this what the Discourse “Permalinks Normalization” is for? Would I be able to strip out anything after ? using that setting?
לייק 1
simon
14 באפריל, 2021, 4:36pm
7
Thanks for the details. It seems that query parameters break Discourse permalink redirection. I’m not sure if that is expected to happen.
4 לייקים
riking
(Kane York)
14 באפריל, 2021, 5:25pm
8
It’s definitely expected, it’s heavily used for permalinks that have e.g. forum.php?topic_id=1234
.
3 לייקים
MiG
14 באפריל, 2021, 5:30pm
9
That makes sense. Is there a way to “transform” an incoming URL before it’s analyzed by the permalinks code? Is that the “Permalinks Normalization” feature?
justin
(Justin DiRose)
14 באפריל, 2021, 6:38pm
10
Yes that’s exactly what permalink normalizations is for
2 לייקים
MiG
14 באפריל, 2021, 6:51pm
11
Can someone give me an example of how I would get rid of ?fbclid= and anything after it, using the Permalinks Normalization setting? Thanks