0

ayuda.htmlルール (以下) があり、新しいエイリアス /msn を追加しました。これには、ディレクトリ インデックス ファイルであるhtml ファイルといくつかの画像などの静的コンテンツが含まれます。

現在、HTML ファイルは表示されますが、画像は表示されません。domain.com/msnまた、またはに行くかどうかによって、さまざまなエラーがありますdomain.com/msn/。最初のケースでは、イメージの場所は に書き換えられていdomain.com/msn/image-blah-blah.jpgませんが、2 番目のケースでは書き換えられています。

これは仮想ディレクトリです。

<VirtualHost *:80>
        ServerAdmin administracion.linux@yellargentina.com
        DocumentRoot "/opt/tomcat-5.5.30/webapps/portalPA"
        ServerAlias *.amarillas.tm.yellargentina.com
        CustomLog /tmp/amarillas-access_log combined
        ErrorLog /tmp/amarillas-error_log
        RewriteLog /tmp/amarillas-rewrite_log
        RewriteLogLevel 9

        JkUnMount       /images/*.gif           w1
        JkUnMount       /images/*.png           w1
        JkUnMount       /images/*.jpg           w1
        JkUnMount       /js/*.js                w1
        JkUnMount       /styles/*.css           w1

        #JkMount        /jkmanager/*            jkstatus
        JkMount         /portalPA               w1
        JkMount         /portalPA/*             w1
        JkUnMount       /msn/*                  w1

        CookieName PaginasAmarillas
        CookieExpires "2 years"
        CookieDomain ".tm.yellargentina.com"
        RewriteEngine on
        RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
        RewriteRule .* - [F]
        Options +FollowSymlinks

        RewriteRule ^/(msn|msn/) /msn/ayuda.html [PT]
        RewriteRule ^/msn/ayuda.html$ /msn/ [R,L]
        RewriteRule ^/msn/(?!ayuda.html)(.*) /msn/$1 [R,L]

        RewriteRule ^/$ /portalPA/index.action   [PT]
        RewriteRule ^/portalPA/index.action / [R]
        RewriteRule ^/(?!portalPA/)(.*) /portalPA/$1 [PT]
</VirtualHost>

アクセスしようとしたときのログdomain.com/msn/

10.248.19.52 - - [23/Aug/2011:16:54:36 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc8338/initial] (2) init rewrite engine with requested uri /msn/yello-apps-mesenger.jpg
10.248.19.52 - - [23/Aug/2011:16:54:36 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc8338/initial] (3) applying pattern '.*' to uri '/msn/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:54:36 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc8338/initial] (4) RewriteCond: input='GET' pattern='^(TRACE|TRACK)' => not-matched
10.248.19.52 - - [23/Aug/2011:16:54:36 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc8338/initial] (3) applying pattern '^/(msn|msn/)' to uri '/msn/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:54:36 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc8338/initial] (2) rewrite '/msn/yello-apps-mesenger.jpg' -> '/msn/ayuda.html'
10.248.19.52 - - [23/Aug/2011:16:54:36 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc8338/initial] (2) forcing '/msn/ayuda.html' to get passed through to next API URI-to-filename handler

アクセスしようとしたときのログdomain.com/msn

10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc02f8/initial] (2) init rewrite engine with requested uri /msn
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc02f8/initial] (3) applying pattern '.*' to uri '/msn'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc02f8/initial] (4) RewriteCond: input='GET' pattern='^(TRACE|TRACK)' => not-matched
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc02f8/initial] (3) applying pattern '^/(msn|msn/)' to uri '/msn'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc02f8/initial] (2) rewrite '/msn' -> '/msn/ayuda.html'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bc02f8/initial] (2) forcing '/msn/ayuda.html' to get passed through to next API URI-to-filename handler
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (2) init rewrite engine with requested uri /yello-apps-mesenger.jpg
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '.*' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (4) RewriteCond: input='GET' pattern='^(TRACE|TRACK)' => not-matched
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '^/(msn|msn/)' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '^/msn/ayuda.html$' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '^/msn/(?!ayuda.html)(.*)' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '^/$' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '^/portalPA/index.action' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (3) applying pattern '^/(?!portalPA/)(.*)' to uri '/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (2) rewrite '/yello-apps-mesenger.jpg' -> '/portalPA/yello-apps-mesenger.jpg'
10.248.19.52 - - [23/Aug/2011:16:55:33 --0300] [amarillas.tm.yellargentina.com/sid#2af084b03cd0][rid#2af084bb82b8/initial] (2) forcing '/portalPA/yello-apps-mesenger.jpg' to get passed through to next API URI-to-filename handler
4

1 に答える 1

0

yello-apps-mesenger.jpg提供された書き換えログに基づいて、問題のある画像であるという結論に達しました。私が理解しているように、前述の画像はその/msnページからリンクされています。

<img>タグをどのように書いたか(またはその画像をどこで使用しているか)がすべてだと思います。次のように、現在のドキュメントに対して相対的に宣言されていると思います<img src="yello-apps-mesenger.jpg" />

さて、それが問題です。

  • domain.com/msn/その画像をリクエストすると、次のようにリクエストされますdomain.com/msn/yello-apps-mesenger.jpg
  • ただし、domain.com/msn(末尾のスラッシュなしで)リクエストすると、画像は同様にリクエスト されdomain.com/yello-apps-mesenger.jpg^/(msn|msn/)単に適用されません。

TBH どちらが間違っているのかわかりません -- あなたはこれについて明確ではありません (少なくとも私は ATM を理解できません)。

この問題を解決するには、次の 2 つの方法があります。

1.受け入れdomain.com/msn/ては受け入れずdomain.com/msn(またはその逆)、これを念頭に置いてルールを作成します。

2.画像の URL を修正します。たとえば、<img src="/yello-apps-mesenger.jpg" />(先頭のスラッシュに注意してください) .. または<img src="/msn/yello-apps-mesenger.jpg" />(/msn/は画像の URL の一部です) のように、Web サイトのルートに対して相対的にします。

于 2011-08-24T00:07:18.563 に答える