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

182
Vistas
htaccess rewrite but query parameter always missing

I want to redirect all:

example.com/{anything}

to:

example.com/index.php?q={anything}

But when I try:

example.com/aaa?param=xxx

I only got 'aaa' in the 'q' parameter, and the '?param=xxx' is lost. why? and how to keep it?

my current rule is:

RewriteEngine on
RewriteRule ^(.*)$ index.php?a=$1 [QSA,L]
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Did you test you actually do not get the param? For me, the param is not visible in the URL, but it it indeed passed.

I simply used this:

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ ip.php?q=$1 [QSA]

And tried this on top of ip.php:

<?php
if(isset($_GET['q'])) {
        echo "PASSED: ".$_GET['q'];
}
?>

In this case, when I visit

mypage.com/SOMETHING 

it seems it stays there, but $_GET param 'q' is set to SOMETHING. Without the above rewrite rules you will get 500 internal error usually.

Also check your server mod_rewrite rules etc. for certain specifics.

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