I need to rewrite links of api/mobile/3/*
to api/mobile/v3/*
due to a restriction of our router, we're modernizing an existing codebase (paths can't start with numbers because they map to php namespaces)
The following works if I add an R flag to the api rewrite - as in it redirects me to the proper place.
I can't have a redirect though as the existing apps that use this API will not follow a redirect.
# make sure mod_rewrite is ON
RewriteEngine On
# rewrite api 3 to v3
RewriteRule ^api/mobile/3/(.*) api/mobile/v3/$1 [QSA]
# send other requests to the application
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [QSA,L]
When I remove the front controller call, Apache gives me a 404 to the correct v3 path I want, so the problem I suspect is somewhere in the combination of the first RewriteRule and the second.
I'm realizing while writing this that this is probably because rewrite just changes what file gets executed and not the SERVER variables.
Is there any way to get apache to rewrite what gets handed off to the front controller to make this work?