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

192
Visualizações
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 Respostas
Responde à pergunta

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 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