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

322
Visualizações
How do i make a htaccess variable optional?

How do i make that the third passed 'get' variable on first line is not mandatory? In other words, page only works if there are 3 'get' variables given, but in my case, i need the third one (e) to be optional. Any ideas?

RewriteRule ^ft/([0-9]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ forum.php?ft=$1&seo=$2&e=$3 [NC,QSA,L]
RewriteRule ^(fc|ft)/([0-9]+)/?$ forum.php?$1=$2 [NC,QSA,L]
RewriteRule ^forums/?$ forum.php [NC,L]
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In that case to handle both 2 and 3 variables, try adding 1 more rules in your htaccess Rules file, have your htaccess rules file in following manner.

Please make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
##Newly added rewrite Rule to handle 2 parameters in uri.
RewriteRule ^ft/([0-9]+)/([A-Za-z0-9-]+)/?$  forum.php?ft=$1&seo=$2 [NC,QSA,L]

##Rest of the rules go from here onwards....
RewriteRule ^ft/([0-9]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ forum.php?ft=$1&seo=$2&e=$3 [NC,QSA,L]
RewriteRule ^(fc|ft)/([0-9]+)/?$ forum.php?$1=$2 [NC,QSA,L]
RewriteRule ^forums/?$ forum.php [NC,L]
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