PHP friendly URL bug?

2 answers

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

All answers to this question, which has the identifier 61150177

The best answer:

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

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.

Last questions

how do i remove the switch on my home screen?
how to edit the JS date and time to update atuomatically?
How to utilize data stored in a multidimensional array
Powermockito not mocking URL constructor in URI.toURL() method
Android Bluetooth LE Scanner only scans when phone's Location is turned on in some devices
docker wordpress container can't connect to mysql container
How can I declare a number in java that is more than 64-bits? [duplicate]
Optaplanner solutionClass entityCollectionProperty should never return null error when simple JSON object passed to controller
Anylogic, get the time a pedestrain is in a queue
How do I fix this syntax issue with my .flex file?
Optimizing query in PHP
How to find the highest number of a column and print two columns of that row in R?
Ideas on “Error: Type com.google.firebase.iid.zzav is referenced as an interface from com.google.firebase.messaging.zzd”?
JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()
PHP total order
Laravel booking system design
neural net - undefined column selected
How to indicate y axis does not start from 0 in ggplot?
Fragments in backStack
Spinner how to change the data