I've set Apache 2.4 server to AddDefaultCharset utf-8
in httpd.conf and my .htaccess
file redirects all non-www and http
to 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]
If I look at HTTP response header, only traffic sent to https://www.example.com
generates a UTF-8 response.
The non-www and http traffic respond with ISO-8859-1 charset.
Anyone know how to ensure all URL-redirect HTTP responses are in UTF-8?
This would seem to be default behaviour, since the Apache redirect response is encoded as ISO-8859-1. However, Apache does allow you to suppress the
charset
parameter in the response by setting thesuppress-error-charset
environment variable:However, it cannot be changed to a different charset.
Reference:
I found a way to change the charset instead of removing it:
This will apply to all request but if you’re not using ISO-8859-1 that’s not really a problem.