I am using Kinsta redirect tool to set a simple redirect from one domain to another. This needs to redirect for all paths, except for one specific path (no redirect should occur if it is present in URL). Example:
https://olddomain.com -> https://new.subdomain.com
https://olddomain.com/blog -> https://new.subdomain.com/blog
https://olddomain.com/faq -> https://new.subdomain.com/faq
However if:
https://olddomain.com/my-admin -> https://olddomain.com/my-admin (NO REDIRECT)
I basically need a single regex rule that can do this as I don't have access to a config file.
Closest thing I got was using (.?./technology) to https://new.subdomain.com/$1 as a test; this resulted in only /technology page being redirected to new sites /technology page. I need the opposite behavior
You can use the negative look ahead (?!b) syntax in regex which basically means "not matching b".
^(?!\/?my-admin$)\/?(.*)$ to https://new.example.com/$1
^ - starts with\/? - Optional slash prefix(?!\/?my-admin$) - Not "my-admin" with an optional slash prefix(.*) - Any characters in caputuring group that becomes $1$ ends withTested here: https://regex101.com/r/jC8nB0/1229