I want to redirect my api calls from sub domain to main domain. My api server is in example.com. Request url is http://foo.example.com/api?service=work&action=all_work, but my file system calls should come through.
<VirtualHost *:80>
ServerName example.com
ServerAlias foo.example.com
RewriteEngine On
<Proxy *>
Order Allow,Deny
Allow from all
</Proxy>
<Location /api>
ProxyPass http://othersite.com/api retry=0
SetOutputFilter DEFLATE
</Location>
DocumentRoot /var/www/example
RewriteCond %{HTTP_HOST} ^(foo.example.com)$ [NC]
RewriteCond %{REQUEST_URI} =/
RewriteRule (.*) /var/www/example/index.html [L]
RewriteCond %{HTTP_HOST} ^(foo.example.com)$ [NC]
RewriteCond %{REQUEST_URI} !=/
RewriteRule (.*) /var/www/example/$1 [L]
</VirtualHost>
But I am getting 404 on the browser.