문제

I know this is a common problem and I know there is a simple solution, however I cannot get the solutions that I have found online to work with my situation.

I have an address as such:

https://localhost/cms

However, when a visitor goes to this address apache cannot find the resource, but if a visitor goes to:

https://localhost/cms/

it works, as expected. So, to combat this I am trying to created a mod rewrite condition, but I am having a bit of trouble. Here is my conf file so far:

<VirtualHost *:443>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(.*)/cms
    RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1/ [L,R=301]
    ProxyPreserveHost on
    ProxyRequests off
    ProxyPass /cms/ http://localhost:9000/cms/
    ProxyPassReverse /cms/ http://localhost:9000/cms/
</VirtualHost>

Any suggestions?

도움이 되었습니까?

해결책

So, I figured it out by using ReverseProxy, here is the updated conf file:

<VirtualHost *:443>
    ProxyPreserveHost on
    ProxyRequests off

    ProxyPass /cms/ http://localhost:9000/cms/
    ProxyPassReverse /cms/ http://localhost:9000/cms/

    ProxyPass /cms http://localhost:9000/cms/
    ProxyPassReverse /cms http://localhost:9000/cms/

</VirtualHost>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top