Apache Content Negotiation Settings

Apache content negotiation settings

    check default settings about Apache
    vim /etc/httpd/conf/httpd.conf
    #
    # For type maps (negotiated resources):
    # (This is enabled by default to allow the Apache "It Worked" page
    #  to be distributed in multiple languages.)
    #
    AddHandler type-map var

    cd /var/www/html/
    ls -l
    -rw-r--r--. 1 root root 17 Sep 21 09:49 index.en.html
    -rw-r--r--. 1 root root 93 Sep 21 09:49 index.html.var
    -rw-r--r--. 1 root root 19 Sep 21 09:50 index.ja.html
    cat index.html.var
    URI: index

    URI: index.en.html
    Content-Type: text/html
    Content-Language: en

    URI: index.ja.html
    Content-Type: text/html
    Content-Language: ja

check display page (Firefox 40 - languages setting)

    none => en-page
    en => en-page
    en-us, en => en-page
    ja, en-us, en => ja-page
    en-us, ja, en => ja-page

re-setting

    # cat index.html.var
    URI: index

    URI: index.en.html
    Content-Type: text/html
    Content-Language: en, en-US

    URI: index.ja.html
    Content-Type: text/html
    Content-Language: ja, ja-JP

re-check(curl)

    # curl -v -H 'Accept-Language: ja-JP, en;q=0.8' -I http://localhost/
    none => en-page
    en => en-page
    en-us, en => en-page
    ja, en-us, en => ja-page
    en-us, ja, en => en-page

apache default addlanguage

ca, cs, da, de, el, en, eo, es, et, fr, he, hr, it, ja, ko, ltz, nl, nn, no, pl, pt, pt-BR, ru, sv, zh-CN, zh-TW

fedora language-region code

ar-SA, as-IN, ast-E, bg-BG, bn-IN, bs-BA, ca-ES, cs-CZ, da-DK, de-CH, de-DE, el-GR, es-ES, fa-IR, fi-FI, fr-FR, gu-IN, he-IL, hi-IN, hr-HR, hu-HU, id-ID, is-IS, it-IT, ja-JP, kn-IN, ko-KR, lv-LV, ml-IN, mr-IN, nb-NO, nl-NL, or-IN, pa-IN, pl-PL, pt-BR, pt-PT, ru-RU, si-LK, sk-SK, sr-Cyrl-RS, sr-Latn-RS, sv-SE, ta-IN, te-IN, th-TH, uk-UA, zh-CN, zh-TW

microsoft language-region code

af-ZA, am-ET, ar-SA, as-IN, az-Latn-AZ, bg-BG, bn-BD, bn-IN, bs-Cyrl-BA, bs-Latn-BA, ca-ES, cs-CZ, cy-GB, da-DK, de-DE, el-GR, en-US, es-ES, et-EE, eu-ES, fa-IR, fi-FI, fil-PH, fr-FR, ga-IE, gl-ES, gu-IN, ha-Latn-NG, he-IL, hi-IN, hr-HR, hu-HU, hy-AM, id-ID, ig-NG, is-IS, it-IT, iu-Latn-CA, ja-JP, ka-GE, kk-KZ, km-KH, kn-IN, ko-KR, kok-IN, ky-KG, lb-LU, lt-LT, lv-LV, mi-NZ, mk-MK, ml-IN, mr-IN, ms-BN, ms-MY, mt-MT, nb-NO, ne-NP, nl-NL, nn-NO, nso-ZA, or-IN, pa-IN, pl-PL, pt-BR, pt-PT, quz-PE, ro-RO, ru-RU, si-LK, sk-SK, sl-SI, sq-AL, sr-Cyrl-CS, sr-Latn-CS, sv-SE, sw-KE, ta-IN, te-IN, th-TH, tn-ZA, tr-TR, tt-RU, uk-UA, ur-PK, uz-Latn-UZ, vi-VN, xh-ZA, yo-NG, zh-CN, zh-HK, zh-TW, zu-ZA

ISO Language Codes(ISO 639-1 Language Codes)

aa, ab, af, am, an, ar, as, ay, az, ba, be, bg, bh, bi, bn, bo, br, ca, co, cs, cy, da, de, dz, el, en, eo, es, et, eu, fa, fi, fj, fo, fr, fy, ga, gd, gl, gn, gu, gv, ha, he, iw, hi, hr, ht, hu, hy, ia, id, in, ie, ii, ik, io, is, it, iu, ja, jv, ka, kk, kl, km, kn, ko, ks, ku, ky, la, li, ln, lo, lt, lv, mg, mi, mk, ml, mn, mo, mr, ms, mt, my, na, ne, nl, no, oc, om, or, pa, pl, ps, pt, qu, rm, rn, ro, ru, rw, sa, sd, sg, sh, si, sk, sl, sm, sn, so, sq, sr, ss, st, su, sv, sw, ta, te, tg, th, ti, tk, tl, tn, to, tr, ts, tt, tw, ug, uk, ur, uz, vi, vo, wa, wo, xh, yi, ji, yo, zh, zh-Hans, zh-Hant, zu

apache, microsoft, ISO Language Codes marge

aa, ab, af, af-ZA, am, am-ET, an, ar, ar-SA, as, as-IN, ay, az, az-Latn-AZ, ba, be, bg, bg-BG, bh, bi, bn, bn-BD, bn-IN, bo, br, bs-Cyrl-BA, bs-Latn-BA, ca, ca-ES, co, cs, cs-CZ, cy, cy-GB, da, da-DK, de, de-DE, dz, el, el-GR, en, en-US, eo, es, es-ES, et, et-EE, eu, eu-ES, fa, fa-IR, fi, fi-FI, fil-PH, fj, fo, fr, fr-FR, fy, ga, ga-IE, gd, gl, gl-ES, gn, gu, gu-IN, gv, ha, ha-Latn-NG, he, he-IL, hi, hi-IN, hr, hr-HR, ht, hu, hu-HU, hy, hy-AM, ia, id, id-ID, ie, ig-NG, ii, ik, in, io, is, is-IS, it, it-IT, iu, iu-Latn-CA, iw, ja, ja-JP, ji, jv, ka, ka-GE, kk, kk-KZ, kl, km, km-KH, kn, kn-IN, ko, ko-KR, kok-IN, ks, ku, ky, ky-KG, la, lb-LU, li, ln, lo, lt, lt-LT, ltz, lv, lv-LV, mg, mi, mi-NZ, mk, mk-MK, ml, ml-IN, mn, mo, mr, mr-IN, ms, ms-BN, ms-MY, mt, mt-MT, my, na, nb-NO, ne, ne-NP, nl, nl-NL, nn, nn-NO, no, nso-ZA, oc, om, or, or-IN, pa, pa-IN, pl, pl-PL, ps, pt, pt-BR, pt-PT, qu, quz-PE, rm, rn, ro, ro-RO, ru, ru-RU, rw, sa, sd, sg, sh, si, si-LK, sk, sk-SK, sl, sl-SI, sm, sn, so, sq, sq-AL, sr, sr-Cyrl-CS, sr-Latn-CS, ss, st, su, sv, sv-SE, sw, sw-KE, ta, ta-IN, te, te-IN, tg, th, th-TH, ti, tk, tl, tn, tn-ZA, to, tr, tr-TR, ts, tt, tt-RU, tw, ug, uk, uk-UA, ur, ur-PK, uz, uz-Latn-UZ, vi, vi-VN, vo, wa, wo, xh, xh-ZA, yi, yo, yo-NG, zh, zh-CN, zh-HK, zh-Hans, zh-Hant, zh-TW, zu, zu-ZA

comment

  • 言語設定の大文字小文字は区別されない(ex. ja-JP, ja-jp)

reference

comments powered by Disqus