我在httpd.conf中将Apache 2.4服务器设置为AddDefaultCharset utf-8 ,我的.htaccess文件将所有非www和httpredirect到https://www.example.com
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [OR] RewriteCond %{HTTPS} !on RewriteRule ^(.*)$ https//www.example.com/$1 [R=301,L,NE]
如果我查看HTTP响应头,只有发送到https://www.example.comstream量生成UTF-8响应。 非www和httpstream量使用ISO-8859-1字符集进行响应。
任何人都知道如何确保所有的URLredirectHTTP响应是UTF-8?
这似乎是默认行为,因为Apacheredirect响应被编码为ISO-8859-1。 但是,Apache允许您通过设置suppress-error-charset环境variables来抑制响应中的charset参数:
# set desired env variable to suppress iso-8859-1 charset SetEnvIf Host ^ suppress-error-charset
但是,它不能被改为一个不同的字符集。
参考: