Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda