I am a noob when it comes to redirect and rewrites and such... My goal is to do a redirect based on what is sent to the server. Example of the urls that will be sent:
and redirect to url based if ! or # is part of it if ! then it would go to https://git.example2.com/userhere/repohere/merge_requests/123 if # then it would go to https://git.example2.com/userhere/repohere/issues/123
Some help with a nginx location block would be nice.
You can't match #123. So you need to use different character ie &
Use below sample rule.
if ($request_uri ~ "^(.*)/!123)"{
return 301 https://git.example2.com/userhere/repohere/merge_requests/123;
}
if ($request_uri ~ "^(.*)/!456)"{
return 301 https://git.example2.com/userhere/repohere/merge_requests/456;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.