I am trying to run a versioned API from separate directories outside my Apache doc root.
My current approach is to try this with the Alias directive:
Alias /api/v1.2/ /var/www/api-v1.2/
Alias /api/v1.1/ /var/www/api-v1.1/
This is working fine, however I am using a PHP framework (Codeigniter) that uses mod_rewrite to route all requests to my index.php front controller:
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?$1 [L]
I can access actual files via the URL, and the alias directive works fine. When I access a URL that the system means to rewrite, the request is served from the doc root.
How can I get my CI application to follow the Alias rules while still routing traffic to each respective front controller?
EDIT: to be clear, I have 3 separate versions of my CI codebase: 1 in the Apache doc root, and 2 others in each aliased directory. I want to route requests to the correct version of the codebase based on the URL (defaulting to the doc root if no Alias is matched).
/var/www/html (doc root)
/var/www/api-v1.2
/var/www/api-v1.1