I've got this set up on my apache configuration file:
ProxyPassMatch ^/webdocs/(.*)$ http://other-domain/webdocs/$1 retry=0
ProxyPassReverse ^/webdocs/(.*)$ http://other-domain/webdocs/$1 retry=0
So when users access to the subdirectory webdocs in my webserver, I proxypass them to this other-domain server.
When I access to:
http://my-domain/webdocs/example/
Everything works fine and the project works as expected.
However, if I access to
http://my-domain/webdocs/example (without trailing slash)
Then a redirection happens and I can see on my address bar the next url:
http://other-domain/webdocs/example/
Any idea why this is happening? I tried many times to rewrite url so I could add a trailing slash before proxy pass, but then all the requests to files have the trailing slash added as well so the project doesn't run properly (assets not found). I tried something like this:
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^/webdocs(.*)$ /webdocs$1/ [L]