We want to “explain” to the web server that all HTML documents that are hosted on the server must be “given” to the client in koi8-r encoding, and not in Windows-1251, as the server does by default. To do this, put the following line in .htaccess:
AddType "text/html; charset=koi8-r" .html .htm .shtml
Having received such .htaccess, the Apache web server will issue a header to the client browser, which will indicate that the document is encoded koi8-r.
If your resource contains HTML documents in different encodings (ISO-8859-1, Windows-1250, Windows-1252, UTF-8), then you may need to disable the forced output of headers with windows-1251 encoding. To do this, add the following line to .htaccess:
AddDefaultCharset Off
In this case, the corresponding encoding must be written on each html page in the form of a tag <http-equiv="Content-type" content="text/html; charset=windows-1251" />
These are examples of the simplest use of Apache configuration capabilities through the .htaccess file.
More options:
DefaultLanguage ru
AddDefaultCharset windows-1251
php_value default_charset "cp1251"