0

過去 2 日間、私は自分の問題を解決するために多くの時間を費やしてきました。誰かが私を助けてくれるかもしれません。

問題: さまざまな URL を、artifactory に使用される 1 つの tomcat webbase-dir にリダイレクトする必要があります。次の URL は tomcat/artifactory webapp を指す必要があります。

maven-repo.example.local ; maven-repo.example.local/artifactory ; srv-example/アーティファクトリ

ここで、maven-repo.example.local はサーバー ホスト名の dns です: "srv-example" JK_mod モジュールを介して tomcat アプリにアクセスしています。webapp は ROOT ディレクトリにあります これは私がこれまでに得たものです:

<VirtualHost *:80>
   #If URL contains "artifactory" strip down and redirect
   RewriteEngine on
   RewriteCond %{HTTP_HOST} ^\artifactory\$ [NC] 
   # (how can I remove 'artifactory' from the redirected parameters? )
   RewriteRule ^(.*)$ http://maven-repo.example.local/$1 [R=301,L] 

   ServerName localhost
   ErrorLog "logs/redirect-error_log"       
</VirtualHost>

<VirtualHost *:80>
    ServerName maven-repo.example.local
    ErrorLog "logs/maven-repo.example.local-error.log"
    CustomLog "logs/maven-repo.example.local-access.log" common   
    #calling tomcat webapp in ROOT
    JkMount /* ajp13w
</VirtualHost>

webapp は「maven-repo.example.local」で動作していますが、「maven-repo.example.local/artifactory」では tomcat が 404 - 「要求されたリソース () は利用できません」を返します。google.com などの別のページにリダイレクトしても、mod_rewrite の効果はないようです。

「system32/drivers/hosts」ファイルに追加されたmaven-repo.example.localを使用して、Windows 7でテストしています

前もって感謝します!

4

2 に答える 2

0

ヒントをありがとう@PHP-Prabhu

シンプルな:

RedirectPermanent /artifactory /.

Apache httpd.conf でうまくいきました!

于 2010-05-12T10:16:51.560 に答える
-1

まず、エイリアスが処理される前にすべてのリダイレクトが処理されるため、Redirect または RedirectMatch に一致するリクエストにエイリアスが適用されることはありません。次に、エイリアスとリダイレクトは構成ファイルに表示される順序で処理され、最初に一致したものが優先されます。

こちらのURLをご覧ください

http://httpd.apache.org/docs/2.1/mod/mod_alias.html

于 2010-05-11T07:56:21.290 に答える