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

444
Visualizações
Editing .htaccess for multiple parameters and pages

I am struggling to understand how to edit my .htaccess file.

Currently i have the following url example.com/fixture.php?country=UK&cup=prem&year=1998&id=123

I would like to achieve example.com/UK/prem/1998/123

On each of the parameters in the URL will have a page for example example.com/UK/prem/ will have info regarding the league and other cups same as the country parameter will have info on the page too.

Currently here is my .htaccess file

RewriteEngine On

RewriteRule ^fixture\.php$ - [L]

RewriteRule ^([^/]+)/?$ /fixture.php?id=$1 [L,QSA]

RewriteRule ^([a-z]{2})/([^/]+)/?$ /fixture.php?country=$1&cup=$2 [L,QSA]

RewriteRule ^([^/]+)/([0-9]+)/?$ /fixture.php?country=$1&cup=$2year=$3&id=$4 [L,QSA]  

Currently I only get a 404 status. I have searched stack overflow and adapted the above code, this is where I think I run into issues....

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

With your shown samples, please try following rules set in htaccess file. Please make sure your htaccess file is present in root folder/directory.

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

RewriteEngine On
##Blocking direct access to fixture.php here, added NC flag here.
RewriteRule ^fixture\.php$ - [NC,L]

##Rules for handling 4 parameters in uri.
RewriteRule ^([^/]*)/([^/]*)/(\d{4})/\d{3}/?$ /fixture.php?country=$1&cup=$2year=$3&id=$4 [L,QSA]  

##Rules for handling 2 parameters in uri.    
RewriteRule ^([a-zA-Z]{2})/([^/]+)/?$ /fixture.php?country=$1&cup=$2 [L,QSA]

##Rules for handling 1 parameter in uri.
RewriteRule ^([^/]*)/?$ /fixture.php?id=$1 [L,QSA]
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