I am trying to move an old app to nginx from apache but I froze on here.
The /.htaccess
RewriteEngine on
RewriteRule ^(.*) public/$1 [L]
The /public/.htaccess
Options +Indexes +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
The structure is really simple. This app has
./application
./*back-end*
./vendor
./*back-end includes*
./public
./public/.htaccess <- this one
./*front-end*
./tests
./.htaccess <- this one
The only way I made it work was by changing the server root
to ./public
and added
location / {
if (!-d $request_filename){ set $rule_0 1$rule_0; }
if (!-f $request_filename){ set $rule_0 2$rule_0; }
if ($request_filename !~ "-l"){ set $rule_0 3$rule_0; }
if ($rule_0 = "321"){
rewrite ^/(.+)$ /index.php?url=$1 last;
}
} #from winginx convertor
but that way my outside of ./public
folders are left out and the app is broken. So I am looking for a way to rewrite it without excluding the back-end folders.