Answer the question
In order to leave comments, you need to log in
How to fix url or 404 errors?
Hello. There is the following problem:
I have an index.php file in the main directory, as well as an "app" folder, in a cat. there are layout files. So, I used htaccess so that the path to these files was ala localhost/about instead of localhost/app/about and without the .php extension.
Here is the htacess file itselfRewriteRule ^about /_app/about.php [L,QSA]
Everything seems to work fine in the url. But!! When I write any number or word after about (for example, localhost/about88888), then everything early shows the page as if it's just about, although in theory there should be an error because there is no such file. The same thing happens when I view a record like details?id=4 - everything is fine, it shows information, but if I add ?id=4gfdgf, then I will still stay on this page, but the data will be empty because there is no such record in bd. (just layout will be displayed).
Question: how to solve this problem? Thanks
Answer the question
In order to leave comments, you need to log in
In my opinion
1) You need to change the regex in htaccess as
about88888 now matches your regex.
2) probably, you need to check if the given element exists in php.
If not, return 404 code and display an error.
^- start of line
& - end
In your case, you say that the line starts with an about and then you actually don't care at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question