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

132
Vistas
Apache RewriteRule allow blank after slash or specified values

I need help with the following Apache RewriteRule

RewriteRule ^(customers)/(active|create)/?$ /mod/customers/?type=$2 [NC,L]

This rule works only if there's something after the / Eg: http://example.com/customers/active

It won't work if the url is http://example.com/customers

How can this RewriteRule be written so http://example.com/customers will work, as well as http://example.com/customers/active

/customers followed by nothing, or /customers followed by /active or /create

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use this regex:

^(customers)(?:/(active|create))?/?$

It uses an optional non-capturing group to allow for a URL such as http://example.com/customers as well as http://example.com/customers/active. The `active|create is still captured in group 2.

Demo on regex101

This regex allows for a trailing / on the URL e.g. http://example.com/customers/ or http://example.com/customers/active/. If that is not desired, just remove the /? in front of the $ i.e.

^(customers)(?:/(active|create))?$

Demo on regex101

over 4 years ago · Santiago Trujillo 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