At proxypass configuration file I have written this line
ProxyPass /directory/ ajp://localhost:8009/directory/
It works perfectly
At htaccess file
RewriteRule ^seconddirectory/(.*)$ http://domain.com.localhost/directory/$1 [P]
P flag implies L.
This works too
If I use only [L] it works too. Anyway, will match with ProxyPass.
But I want the Proxy redirects via AJP only if a referer contains /action if not you can't use the ProxyPass
I tried to make a condition with RewriteCond
RewriteCond %{HTTP_REFERER}% !/action
RewriteRule .? - [S=2]
RewriteRule ^seconddirectory/(.*)$ https://domain.com.localhost/directory/$1 [L]
RewriteRule .? - [S=1]
RewriteRule ^seconddirectory/(.*)$ https://domain.com.localhost/404 [L]
If (referer no contains /action), in this case, is skipping 2 lines and is redirected to a 404 page
If the URL is
https://domain.com.localhost/seconddirectory/anything
I'm being redirected to https://domain.com.localhost/404
This is correct
If referer contains /action
I'm not beign redirected to https://domain.com.localhost/directory/$1
This is the referer where I come from https://domain.com.localhost/controller.php/module/atoken/action (referer)
Any suggestion?