Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
Apache RewriteRule ejecutándose dos veces

Tengo una necesidad bastante simple: redirigir cualquier solicitud a un solo archivo.

Así que puse, en la raíz de mi directorio apache, un .htaccess:

 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^ index.php?q=test [L,QSA] </IfModule>

De hecho, todas las solicitudes se redirigen a index.php , pero aparece algo extraño: PHP $_SERVER['QUERY_STRING'] contiene q=test&q=test que muestra que la redirección ocurre dos veces (y REDIRECT_URL no contiene index.php pero el URL pasada que conduce a que sea igual a REQUEST_URI.

¿Cómo puedo arreglar eso, considerando que solo tengo la forma .htaccess para configurar Apache?

Prueba:

  • Cree una carpeta en su raíz web de apache (por ejemplo: redirigir/)
  • agregue un archivo .htaccess que contenga el código anterior
  • agregue un archivo index.php descargando $_SERVER para ver el resultado
  • intente con cualquier URL (por ejemplo, redirect/foo/bar) y debería ver el volcado.

Versión de Apache: 2.4.33; Versión de PHP: 7.2.4 (y 5.6.35); WAMP (Windows) y Red Hat (Linux).

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!