I’m trying to match a simple condition in apache virtual host to rewrite the original URL and redirect to the load balancer definition.
The condition should match against URL like
http://myhost.mydom.com/my-first-path.xyz/mypath-sec/other-things
for the string
/my-first-path.xyz/mypath-sec in the REQUEST_URI,
and rewrite it into
balancer://my-loadbalacer-definition/mypath/other-things (removing the -sec part from mypath-sec)
This is the condition code:
<IF "%{REQUEST_URI} =~ m#/my-first-path.xyz/mypath-sec#">
RequestHeader set Host my-first-path.xyz
RewriteRule ^/my-first-path.xyz/(.*)-.*(/.*)$ balancer://my-loadbalacer-definition/$1$2
</IF>
It should be quite linear and easy (also if I’m very noob in these apache things…) but there’s no way to make it working, always I get the following error in error_log as if the REQUEST_URI match returns false
AH00128: File does not exist: /my-first-path/mypath-sec
Any idea ?
Thanks a lot in advance.