Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Help making a rule #215

Open
Maple38 opened this issue Sep 6, 2022 · 3 comments
Open

[Question] Help making a rule #215

Maple38 opened this issue Sep 6, 2022 · 3 comments

Comments

@Maple38
Copy link

Maple38 commented Sep 6, 2022

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.

@Dniness
Copy link

Dniness commented Sep 16, 2022

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

@Maple38
Copy link
Author

Maple38 commented Sep 16, 2022

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

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

@Maple38 Maple38 closed this as completed Sep 16, 2022
@Maple38 Maple38 reopened this Sep 16, 2022
@Dniness
Copy link

Dniness commented Sep 16, 2022

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants