Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!