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

284
Visualizações
PHP friendly URL bug?

I just started a course of implementing MVC pattern using PHP and I think I'm experiencing a bug regarding friendly URL engine. The site I'm creating has the follow URL syntax: http://[site]/[controller]/[method]/[parameters] .

Until now it works in a very simple way: I access a controller and is printed on screen which controller is beeing accessed (printed by a method from controller's class). The problem is that when I access the URL http://cursophp/cliente (a real controller) it works and when I try an inexistent controller WAMP shows an error screen that informs that the page couldn't be found; but, when I try to access http://cursophp/produto (also a real controller), an 404 error from Apache is exhibited! And I also tried with other words like: produto1, produto2, product, product1 ("prod" prefix) and the same 404 error is exhibited!

Using Composer or including directly the controller file with "require" results in the same problem.

Is it a known bug or am I making a mistake?

htacess content:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !f
RewriteCond %{REQUEST_FILENAME} !d
RewriteRule ^(.*)$ index.php/$1 [L]

Just adding more details:

When I try "pro" as controller's name: enter image description here

When I try "prod" (or any word with "prod" prefix): enter image description here

When I try "aaaa" (or any word, of any length, that doesn't correspond to a controller's name): enter image description here

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

0

The problem is probably in function that checking the route. Try to debug on which line it's starting show the error. However, it's impossible to suggest you a specific way of solving this problem without providing more details

over 4 years ago · Santiago Trujillo Relatório

0

This PHP script is crappy, because it does not handle unknown controllers properly.

Instead it should respond with HTTP404, when the file to load cannot be located.

Generally speaking, you'd need to fix that in file Core.php.

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