サブドメインを別のログインページにリダイレクトする

サブドメインを別のログインページにリダイレクトする

私の vhost.conf ファイルには、次のようにサブドメインが設定されたドメインがあります。

<VirtualHost *:80>
    ServerName mysite.com
    ServerAlias www.mysite.com
    DocumentRoot /opt/mysite/webapps/ROOT/
    ProxyPassMatch / ajp://localhost:8084
</VirtualHost>

<VirtualHost *:80>
    ServerName subdomain.mysite.com 
    ServerAlias www.subdomain.mysite.com
    DocumentRoot /opt/mysite/webapps/ROOT/
    Redirect /index.jsp /index2.jsp
    ProxyPassMatch / ajp://localhost:8084
</VirtualHost>

メインサイトは読み込まれますindex.jspが、サブドメインで別の JSP ファイル ( ) を読み込むようにしたいと思いますindex2.jsp

リダイレクトを使用しようとしましたが、index.jspサブドメインに移動するだけです。

答え1

編集

以下は が存在するため誤りですProxyPassMatch

Apache VirtualHostを最後に設定してから随分経ちましたが、

DirectoryIndex index2.jsp

あなたが探しているものです。

したがって、完全な構成は次のようになります。

<VirtualHost *:80>
    ServerName subdomain.mysite.com 
    ServerAlias www.subdomain.mysite.com
    DocumentRoot /opt/mysite/webapps/ROOT/

    # Serve index2.jsp as index file
    DirectoryIndex index2.jsp

    ProxyPassMatch / ajp://localhost:8084
</VirtualHost>

編集

十分に調べなかったのですが、このProxyPassMatchディレクティブは他の多くのコマンドを上書きしているようです:

As the ProxyPassMatch directive is evaluated as the very beginning of each request:
  -AddType (for MultiView) or DirectoryIndex directives are not usable
  -right management per directory is not available
  -each Alias directive needs another proxy rule

問題はあなたのindex2.jsp意志が一度もないサーバーはすでに ProxyPass / と一致しているため、Apache によって提供され、すでに に渡されていますajp://localhost:8084

次に、 または を管理する必要がindex.jspありindex2.jspますajp://localhost:8084

関連情報