How to use the Url Cleaner module to replace characters? #247
-
TrianguloY mentioned in the issue 245 that it was possible to replace URL encoding ("%2F" and other codes like that) for the actual characters they represent ("/" in that case) using the Url Cleaner.
But after reading the docs that are linked in the app I got the impression that it works only for removing strings, not adding/replacing them. After testing (although I didn't really know what to test lol), I got the same impression. So, if anyone knows if it really is possible and I just missed something, I'd appreciate the help. Code I tested (there's no replacement there because I just didn't know how to add that): |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think I didn't explain it correctly. What I was trying to say is that the Url Cleaner module is designed to both remove parameters and extract redirections from them. In your patterns file you had some in the format (can't remember exactly) something like If you use instead the cleaner module, you should be able to add an entry for that under 'redirections', something like (not tested): In any case, if you prefer the patterns module you can still use it of course! |
Beta Was this translation helpful? Give feedback.
I think I didn't explain it correctly.
What I was trying to say is that the Url Cleaner module is designed to both remove parameters and extract redirections from them.
In your patterns file you had some in the format (can't remember exactly) something like
"google.com/?redirection=(.*)"
->"$1"
.The issue is that the url parameter is encoded, so the pattern output is something like
"google.com%2F123"
, so you had a bunch of"%2F"
->"/"
automatic replacements.If you use instead the cleaner module, you should be able to add an entry for that under 'redirections', something like (not tested):
"custom": { "decode": { "urlPattern": "google.com", "redirections": [ "google.com/?redirection=(.*…