個別のErrorDocumentの設定(Apache2.0.47)

このQ&Aのポイント
  • Apache2.0.47で個別のErrorDocumentを設定する方法について解説します。
  • VirtualHostを使用して複数のサイトを運営している場合、httpd.confの設定でそれぞれのサイトに個別のErrorDocumentを設定することができます。
  • .htaccessを使用せずに設定する方法を紹介します。
回答を見る
  • ベストアンサー

個別のErrorDocumentの設定(Apache2.0.47)

VirtualHostを使って複数のサイトを運営しているのですが、 .htaccessを使わず、httpd.confの設定でそれぞれ個別に ErrorDocumentを設定するにはどのようにすればいいのでしょうか? <VirtualHost *:80>の中でErrorDocumentを設定してみてもAdditionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. こんな風なエラーが出てしまいます。 #.htaccessを使ってErrorDocumentを設定すると、以下のようなことが起きるのが嫌なのでこの質問をしました。 http://***.com/hoge.cgiが500だったとすると ここへアクセスするとhttp://***.com/505.html のようにURLが変わってしまう よろしくお願いいたします。

質問者が選んだベストアンサー

  • ベストアンサー
  • osamuy
  • ベストアンサー率42% (1231/2878)
回答No.1

> #.htaccessを使ってErrorDocumentを設定すると、 > 以下のようなことが起きるのが嫌なのでこの質問をしました。 応答ドキュメントとしてhttp://~で始まるような絶対URLを記述しているのでは。

参考URL:
http://httpd.apache.org/docs/mod/core.html#errordocument
makihiro
質問者

お礼

ありがとうございました。相対パスで指定したところ解決いたしました。 (絶対パスで入力するとエラーが出たのですが、) 応答ドキュメントとしてhttp://~で始まるような絶対URLを記述しているのでは。 >確かにそうでした(^^;)

関連するQ&A

  • カスタマイズした404ページが設定できない

    404ページと.htaccessの格納場所は、 http://www.***1.jp/***2/***3/404.html http://www.***1.jp/***2/***3/.htaccess 1) .htaccessの記述が下記の場合… ErrorDocument 404 /***1/***2/404.html →404.htmlの画像、cssがきちんと表示されない 例えば、存在しないページhttp://www.***1.jp/***2/***3/***4/index.htmlへ飛ぼうとした場合に表示されたhtml内の画像やhrefを見てみると、http://www.***1.jp/***2/***3/***4/404.htmlを読もうとしている 2) .htaccessの記述が下記の場合… ErrorDocument 404 /404.html →カスタマイズした404ページが表示されず、下記文言が追記されている。 Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 3) .htaccessの記述が下記の場合… ErrorDocument 404 http://www.***1.jp/***2/***3/404.html 問題なく表示。でも、リダイレクトになってしまい、これはあまり推奨されてないようです。 アドバイスいただけないでしょうか。 よろしくお願いします。

  • apache VirtualHostが実行されない

    Apache設定初心者です。 httpd.conf で <VirtualHost> 内の DocumentRoot が表示されなくて困っています。 https://111.112.113.114 を実行すると DocumentRoot が /home/httpd/hoge/err/httpdocs となってしまいます(VirtualHost内の DocumentRoot が実行されない) よろしくお願いします。 【記述内容】 NameVirtualHost 111.112.113.114:80 NameVirtualHost 111.112.113.114:443 DocumentRoot /home/httpd/hoge/err/httpdocs <IfModule mod_ssl.c> <VirtualHost 111.112.113.114:443> ServerName hoge.co.jp:443 ServerAlias www.hoge.co.jp UseCanonicalName Off SuexecUserGroup use01grp01 DocumentRoot /home/httpd/hoge/httpdocs ErrorLog /usr/hoge/logs/error ScriptAlias /hoge-bin/ /usr/hoge-bin/ Alias /hoge1 /usr/hoge1/ Alias /hoge2 /use/hoge2 SSLEngine on SSLVerifyClient none SSLCertificateFile /usr/hoge/ctr/hoge.ctr </VirtualHost> </IfModule>

  • apacheのバーチャルホストの設定方法

    MacOSX Snow Leopardを使っています。 apacheは2.2.11です。 httpd.confで/http/Virtual.confを読み出して設定しています。 Virtual.conf ------- # #VirtualHost.conf # NameVirtualHost *:80 <VirtualHost *:80> ServerName www.xxxxx.com DocumentRoot /http/www.xxxxx.com </VirtualHost> ------- ※www.xxxxx.comは、正しく設定されています。 の設定をし、httpdを再起動したところ、IPアドレスでアクセスしても、ドメインでアクセスしても、httpコード403になってしまいます。 *httpdで起動時、エラーはでません。 *httpd -tはSyntaxOK *httpd -sは   VirtualHost configuration:   wildcard NameVirtualHosts and _default_ servers:   *:80 is a NameVirtualHost    default server www.xxxxx.com (/http/Virtual.conf:11)    port 80 namevhost www.xxxxx.com (/http/Virtual.conf:11)   Syntax OK です。 virtual.confをすべてコメントアウトしたところしっかりアクセスできました。 よろしくお願いします。

  • RedHat7.3 apache-2 ユーザーのページが見れない。

    ブラウザを立ち上げて http://localhost/ ってやると/usr/local/apache2/htdocs/index.htmlが見えるのですが、 taroというユーザーを作ってホームディレクトリのしたに ~taro/public_html/index.html をつくってやると Forbidden You don't have permission to access /~taro on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.0.39 Server at localhost Port 80 といわれちゃいます。ちなみに.httpd.confの中の所では #UserDir public_html <IfModule mod_userdir.c> UserDir public_html </IfModule> となっています。 どうすれば見れるようになるのでしょうか?

  • 訳してください

    You don't have permission to access /cgi-bin/hok_food/ibo.cgi on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request この意味判るかたいらしたら教えてください

  • TripodのCGI

    TripodでCGIを設置したんですが トップページからcgiへのリンクをクリックしても Forbidden You don't have permission to access /○○○/cgi-bin/sample.cgi on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. と表示されてしまいます。 マイアカウントでCGIの設定は済んでいます。

    • 締切済み
    • CGI
  • YAHOOに繋がりません。。。

    4月に自宅にもどってきて単身赴任先で使ってたPCを 既存のADSLに繋いだのですがYAHOOのページ だけが表示できません??? The requested URL /index_lt.html was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. のメッセージが。。。。 もう一台のPCでは大丈夫なのですが、このPCだけ。。。 何でなのでしょうか?

  • サーバー上の2GB以上のファイルをダウンロードさせるとforbiddenになる

    サーバーに2GB以上のファイル「A.zip」をアップロード。 「A.zip」のアドレスを指定してダウンロードしようとすると、 「Forbidden You don't have permission to access /A.zip on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 」 と出ます。 1GBや1.5GB程度のファイルはダウンロードできるため、 A.zipがダウンロードできないのは、 おそらくその大きな容量が問題だと思います。 ダウンロードができるようにしたいのですが、 どのようにすればよいでしょうか? .htaccessをいじくればいいのでしょうか?

  • 下記の文章を翻訳願います

    You don't have permission to access /cgi-bin/deep/boutique/view.cgi on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

  • htaccessを他サーバーにコピーしたら正常に機能しないのですが…

    A社のサーバーで.htaccessでパスワードによるアクセス制限をしていました。 B社のサーバーでも同じパスワードで制限をかけようと、A社のサーバに入れてあるものと全く同じ.htassess、.htcomment、.htdircomm、.htpasswdを制限目的のディレクトリに入れたのですが、その制限エリアのファイルにアクセスしようとすると、パスワードとユーザ名は聞いてくるものの、正しい情報を入れても受け付けてもらえず、3回トライすると Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. というエラーになってしまいます。 .htaccessに記述してある.htpasswdの位置はちゃんとB社用に書き換え、間違っていないと思うのですが…。 ちなみに、.htaccessがある場所が/public/aaa/member/内だとすると、 .htpasswdも同じところにおいてあるので AuthUserFile /public/aaa/member/.htpasswd と記述しています。 試しにA社の.htpasswdをわざと間違った場所に置いてみたのですが、それで表示されるエラーには、上記のエラーにあるAdditionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. という部分は含まれていませんでした。 一体、どこが悪いのでしょうか? 原因を思いつかれる方がいらっしゃいましたらご指摘頂けないでしょうか? よろしくお願い致します。