php - Converting .htaccess files to nginx
one text
Solution:
Try this:
server {
server_name example.com;
root /path/to/files;
charset utf-8;
rewrite (.*) /public/$1;
location /public/ {
try_files /public$uri /public$uri/ /public/index.php?$uri$is_args$args;
}
}
ALTHOUGH, by the looks of it, you simply need your root
directive set to public
and disrespect your "bad" .htaccess.
This will be a lot cleaner/more secure also:
server {
server_name example.com;
root /path/to/files/public;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$uri$is_args$args;
}
}
Source