하위 도메인을 다른 로그인 페이지로 리디렉션

하위 도메인을 다른 로그인 페이지로 리디렉션

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.

관련 정보