How do I set Character Encoding to UTF-8 for default.html?

前端 未结 5 1524
庸人自扰
庸人自扰 2020-12-01 13:05

I spent the last few hours getting my website to validate HTML 4.01 Strict and I actually have succeeded in that but there is still one warning which I can\'t get rid of. Th

5条回答
  •  借酒劲吻你
    2020-12-01 13:26

    Okay, I have come up with a partial solution to my problem. As it was only the default.html file which was causing the warning I assumed that the server was doing something special to it because of its name. So I made a new file called home.html with the same contents as the default.html file and pointed the .htaccess file to the new file (see line 3 below).

    # Use PHP5 as default
    AddHandler application/x-httpd-php5 .php
    DirectoryIndex home.html
    AddDefaultCharset UTF-8
    

    This fixed the problem and all files are now recognised as UTF-8. I'm still not sure what the server was doing to the default.html file or where the settings concerning that are but as my problem is gone I will forget about that.

提交回复
热议问题