Up to the end, it is impossible to understand what exactly the bug is, but maybe someone has come across such a bug. If you enter Russian characters in the address bar, namely the letter "X" (after which there must be some other characters), then an error is returned.

http: // localhost / dilapidated
Not found
The requested URL was not found on this server.

This problem is only with one character, and if autoload is used, you can check it using some framework.
Without the letter "X" page opens normally.

In a lower version of php, there is no such problem, but again the problem may not be in PHP, but in the apache or OS itself.

  • 2
    use urlencode or transliteration, and it is not clear how routing php or apache performs routing, etc. those. For the full question, I think you need to give the methods of processing requests and configurations most likely you have in the route a typo ветхий where х Latin X and not Russian. You can check by expanding the string in hex and compare the character codes of the source string and the string entered in the browser - Naumov
  • Here it is not a urlencode, and routing is not the same because This error appears absolutely in different frameworks. - Vayas
  • What kind of framework do you use? Copy the routing settings from a pair of those for which errors occur. - Naumov
  • For example YII you have installed php7? I need a person who has php7 installed. Otherwise it will be difficult to understand. This problem is not observed in other versions of php. - Vayas
  • Yes, it is installed, but I have no problems with routing, Not Found apache2 gives you a check, does the query reach at least index.php? I had a problem like this because of the incorrect htaccess apache did not reach the index and gave 404 as if there was no file - Naumov

1 answer 1

This problem appears due to the peculiarities of the windows OS, only a similar problem persists on it, under UNIX everything works fine.

Fixing the current problem turned out to be editing the .htaccess file. Initially, it looked like this:

 RewriteRule ^(.*)$ index.php 

.* is a regular expression, however simple . this is not "any character" in the regular expression, but the bypass of the source URL.

A regular is not ^.$ , Which means that it is enough that there is at least one any character in the urle. And he is always there - leading slash.
For any other length of the URL, the point will also work. This is done to reduce the cost of the regular expression mechanism.

Therefore, it is constantly recommended that if the router is engaged in parsing the URL, then the rewrite is not to do ^(.*)$ index.php , but . index.php . index.php .
The whole point of a lonely point is to quickly coincide with any address. In general, it is not even a regular. Therefore .htaccess fixed on:

 RewriteRule . index.php