I want to access domain.com/api/(.*)
instead of domain.com/public/api/(.*)
Directory structure:
domain.com
__folder1
__folder2
__public
____api
______.htaccess2
____afolder1
____afolder2
____index.html
__folder3
__file1
__file2
__.htaccess1
.htaccess1
RewriteEngine on
SetEnv APPLICATION_ENV production
RewriteRule ^$ /public/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_URI} !^/api/
RewriteRule ^(.*)$ /public/$1 [L]
.htaccess2
RewriteEngine on
SetEnv APPLICATION_ENV production
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
I tried different combinations and I came to this simplest one. I tried Alias, put the api folder on root directory, etc.
To mention that the index.html from public folder is loaded first at domain.com, public folder is document root.