0
0

More than 3 years have passed since last update.

MAMPのバーチャルホスト設定でShift_JISのHTMLに対応する

Last updated at Posted at 2020-06-22

MAMPのバーチャルホスト機能は複数サイトの開発・運用に非常に便利ですが、Webサイトの文字コードがShift_JISの場合には文字化けが発生してしまいます。
(現在ではUTF-8が一般的ですが、長い歴史のあるWebサイトの運用などでは稀に遭遇します)

バーチャルホストの設定をする httpd-vhosts.conf 内に下記のように記述することで、該当サイトのみShift_JISでの表示をおこなうことが可能です。

※ポート番号(8001)やルートディレクトリのパス(/path/to/shift_jis_website/)は適宜書き換えてください。

httpd-vhosts.conf

Listen 8001

<virtualhost *:8001>
    DocumentRoot "/path/to/shift_jis_website/"
    <Directory "/path/to/shift_jis_website/">
        AddType "text/html; charset=Shift_JIS" html
    </Directory>
</virtualhost>

なお、バーチャルホストの設定に関しては下記の記事が参考になります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0