Question

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?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top