I am setting up a local environment for testing using WAMP.
The app (angular app) sits in the /wamp/www/app/ directory. It makes requests to another api by sending requests to another route on its same server. (Specifically to /wamp/www/api/route)
We have a dev api server that exists at http://api.com. We have another test instance of the angular app at http://testapp.com/app/ that can send requests to http://api.com by pointing at http://testapp.com/api/route.
The way that this works in the test instance (non local) is that we have a .htaccess file at http://testapp.com/api/route that takes requests to http://testapp.com/api/route/* and sends them to http://api.com/*
The .htaccess file that does this is as follows:
<IfModule mod_rewrite.c> RewriteRule (.*) http://api.com/$1 [NC,P] </IfModule>
When I copy this .htaccess file to my /wamp/www/api/route/ directory I expect the following behavior:
What I want
The app will send a request to /wamp/www/api/route/stuff/ and the .htaccess file in /route/ takes that request, and proxies it to http://api.com/stuff
What I get
The app will send a request to /wamp/www/api/route/stuff/, and get a 404 back.
I've made sure that AllowOverride all is set, that the rewrite engine is on, and that mod-rewrite is enabled. I know the .htaccess file is being seen, because if I put garbage in it, i get a 500 instead of the 404, and my garbage gets into the log.
Any help would be much appreciated! Thanks.
After help from Purefan, I enabled rewrite logging, and since enabling, there have been no rewrite attempts, which would suggest that the rewrite rule is not ever being executed on the requests.
I have now tried to change the flow of how I call the rewrite rule.
I created a directory in the httpd config file, as follows:
<Directory "c:/wamp64/www/api/route"> Options +FollowSymLinks RewriteEngine on <IfModule mod_rewrite.c> RewriteRule (.*) http://api.com/$1 [NC,P] </IfModule> </Directory>
And I still get the same behavior