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>
なお、バーチャルホストの設定に関しては下記の記事が参考になります。