Take the simplest script, call it testget.php:

<html> <head> <meta charset="UTF-8"> </head> <body> <?php setlocale(LC_ALL, 'ru_RU.UTF-8'); $rowname = "мм"; $formid = 11; echo "<a href=\"delete.php?zname=$rowname&formid=$formid\"> Удалить </a>"; ?> </body> </html> 

and run from some folder:

http://www.example.com/sp/testget.php

If you select the link, the script "crashes" at http://www.example.com/

If you replace $ rowname with one Russian letter m, then everything works fine and the text is issued

Not found the requested URL /sp/delete.php was not found on this server.

Everything, of course, works fine if $ rowname contains Latin characters and most Russian letters, including spaces, for example, "Type of program". But if you add another m "Type of programs" - everything crashes. I'm at a loss. Please tell me what it is and how to deal with it.

  • mod_rewrite enabled? RewriteRule present? - vp_arth
  • Unfortunately, I am not allowed on my hosting to even see httpd.conf. I asked this question to the support service and wait for them to solve the problem and comment. - kapusta
  • one
    I received a response from the support service. Their mod_security module considers some combinations of Russian letters as an attempt to break into SQL (SQL injection). There they have a very complicated regesp and if the pattern fits, the server redirects the request to the root folder with code 302. After turning off mod_security, everything works fine. - kapusta

1 answer 1

To work with non-Latin characters (and generally everything that is different from numbers) in the URL string is best done through urlencode

 $rowname=urlencode($rowname); 

And the inverse transformation itself through urldecode

  • In general, this is true. But in this case does not help. urlencode () recodes 'mm' to% D0% BC% D0% BC, which happens even without urlencode (). It seems to me that urlencode () is useful when there are spaces and other non-numeric characters in the string. - kapusta
  • The main thing is ampersands ( & ) and equals ( = ), the rest is not critical, browsers are smart now =) - vp_arth