Addon icon indicating copy to clipboard operation
Addon copied to clipboard

How does the redirections work?

Open piyushgarg opened this issue 4 months ago • 0 comments

I am having a website or link http://domain.com/path1?env=val1&envId=val2 and I want to redirect it clean URL to http://domain.com/path0/path1 rules are working fine but not redirections

{"providers":{"domain.com":{"urlPattern": "^https?:\/\/(?:[a-z0-9-]+\.)?domain\.com","rules": ["env","envId"],"redirections":["^https?:\/\/(?:[a-z0-9-]+\.)?domain\.com\/?path0?\/path1"]}}}

I have looked at the lot of examples in data.minify.json but could not understand, I am trying but this piece of code is not working.

this.getRedirection = function (url) {
            let re = null;

            for (const redirection in enabled_redirections) {
                let result = (url.match(new RegExp(redirection, "i")));

                if (result && result.length > 0 && redirection) {
                    re = (new RegExp(redirection, "i")).exec(url)[1];

                    break;
                }
            }

            return re;
        };

I have also looked at the redirections documentation but it does not have sample.

piyushgarg avatar Sep 06 '25 12:09 piyushgarg