HeaderEditor icon indicating copy to clipboard operation
HeaderEditor copied to clipboard

[Question] Help making a rule

Open Maple38 opened this issue 2 years ago • 3 comments

Hey, I've been struggling to make a specific rule for a while now. I'm in Turkey right now, but I don't like how websites usually load in Turkish (generally it will be website.com.tr). I have made rules to redirect some sites, such as Amazon, but I need help with one site in particular. Also, I don't have too much programming knowledge, so I've been struggling.

So, imagine the site is website.com.tr/content. I require it to redirect that to usa.website.com/content?ignoreredirects=true. The main part I'm struggling with is preserving the 'content' part of the site, because it is between two things. I tried looking into regex, but couldn't really figure it out. Thank you for your time.

Maple38 avatar Sep 06 '22 17:09 Maple38

/([^/]+\/\/)(w+\.)?([^/]+)\.tr(\/[^?]+)\??(.*)?/

Dniness avatar Sep 16 '22 15:09 Dniness

/([^/]+//)(w+.)?([^/]+).tr(/[^?]+)??(.*)?/

Thanks a lot, but where in the url do I put this?

Maple38 avatar Sep 16 '22 15:09 Maple38

val.match(/([^/]+\/\/)(w+\.)?([^/]+)\.tr(\/[^?]+)\??(.*)?/)

then you will get a array, and then you can do it by yourself.

Dniness avatar Sep 16 '22 15:09 Dniness