Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
Using regex to redirect old domain to new while maintaining paths, but not redirecting if specific path in url exists

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

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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 with

Tested here: https://regex101.com/r/jC8nB0/1229

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda