1

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.

weeheavy
  • 4,089
  • 1
  • 28
  • 41
danielpopa
  • 111
  • 3
  • Try to raise your mod_rewrite Loglevel. This is achieved differently for Apache 2.2 and 2.4: http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging – weeheavy Feb 13 '13 at 09:55

0 Answers0