i am trying to write two rewrite rules which are PASS THROUGH or PROXY so that i can hide the underlying url.
Case1:
When a request comes to app.domain.com/folder1/folder2/ it should go through a.b.mydomain.com/folder1/folder2/ what ever comes after folder2 in app.domain.com/folder1/folder2/ should be added to a.b.mydomain.com/folder1/folder2/ after folder 2.
Example app.domain.dom/folder1/folder2/search/?q=test should be passed through a.b.mydomain.com/folder1/folder2/search/?q=test
Case2:
When a request comes to company1.app.domain.com/folder1/folder2/ it should go through company1.a.b.mydomain.com/folder1/folder2/
This company1 may be varying i should be able to fetch it dynamically and append to the second url.
what ever comes after folder2 in company1.app.domain.com/folder1/folder2/ should be added to company1.a.b.mydomain.com/folder1/folder2/ after folder 2.
Example
company1.app.domain.com/folder1/folder2/search/?q=test should be passed through company1.a.b.mydomain.com/folder1/folder2/search/?q=test
I have tried to write the following :
One rule:
RewriteRule ^([A-Za-z0-9-]+).app.domain.com\/folder1\/folder2\/$ http://%1.a.b.mydomain.com/folder1/folder2/$1 [PT]
and another one i tried
RewriteCond %{HTTP_HOST} ^([a-z0-9]+).app.domain.com
RewriteRule ^services/v1/(.*) http://%1.a.b.xyz.com/services/v1/$1 [P]
Some how both of the trials havenot work, Please help me.. thanks