For some reason, some extern websites have links to my website subdomain.example.com looking something like this: <a href="https://subdomain.example.com/https://subdomain.example.com/index.php?id=54597">Link</a>
I cannot get these links corrected as I have no control over these links. So instead of showing a 404 error, I would like to redirect https://subdomain.example.com/https://subdomain.example.com/index.php?id=54597
to https://subdomain.example.com/index.php?id=54597
via nginx but I cannot get a location to match, once it includes a colon. Is there a way to get this to work?
something like
location ~ "^https://subdomain.example.com/index.php$" {
return 301 /index.php?$query_string;
}