1

URL条件に基づいて、httpリクエストをtomcatまたはデフォルトのDocumentRootベースにリダイレクトしようとしています。

例:

IF url contains /css/ then serving the file from /var/www
else
redirect to tomcat using JKMount

httpd.conf の構成は次のとおりです。

<VirtualHost *:80>
     ServerName www.example.com
     DocumentRoot /var/www
     RewriteEngine on 
     LogLevel debug
     RewriteLogLevel 3
     RewriteLog logs/apache-mod_rewrite

     RewriteRule ^/css/(.*)$ /var/www/css/$1 [L]

     RewriteCond $1 !^portal
     RewriteRule ^/(.*)$ /portal/?user=YES [L,PT]
     JkMount  /* failover
</VirtualHost>

http://www.example.comにリクエストしようとすると、Tomcat にリダイレクトされ、ページが正しく提供されます。

ただし、 http://www.example.com/css/sample.cssをリクエストしようとすると、apache はエラー 404 を返します。ありがとうございます。

4

0 に答える 0