重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

【GOLF me!】初月無料お試し

HTMLの内容でないのですが、他に適当なカテゴリがなかったので、ここで質問させてください。

ただいま、www.example.jp を運営しています。
ここで、www.example.jp/sub ディレクトリを sub.example.jp でアクセスさせたいです。

httpd.conf か .htaccess にどのように書けばいいのでしょうか?

結構ググったんですけど、検索ワードが適当でないのか、いまいち適切なページが見つかりませんでした。

ご教示のほどよろしくお願いします。

A 回答 (2件)

??? 二つ書けばいいんじゃない?



<VirtualHost *:80>
ServerName www.example.jp
DocumentRoot /home/foo/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName sub.example.jp
DocumentRoot /home/foo/htdocs/sub
</VirtualHost>

この回答への補足

それも試しました。

sub.example.jp にアクセスすると、

[an error occurred while processing this directive] [an error occurred while processing this directive]

と表示されます。

補足日時:2014/07/18 01:09
    • good
    • 0
この回答へのお礼

原因がわかりました。
ファイル内にある SSI へのパスが変わった為でした。

ありがとうございました。

お礼日時:2014/07/18 01:29

httpd.conf



NameVirtualHost *:80

<VirtualHost *:80>
ServerName sub.example.jp
DocumentRoot /var/www/sub
</VirtualHost>

この回答への補足

ご回答ありがとうございます。

説明が足りませんでした。
www.example.jp 自体も VirtualHost 設定をしているのです。

www.example.jp は /home/foo/htdocs にあり、
sub.example.jp は /home/foo/htdocs/sub にあります。

補足日時:2014/07/17 22:39
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!