.htaccess

Zonimi alex.zonimi at gmail.com
Sat Jun 27 21:49:51 UTC 2020


Hello, I would like to know how do I convert this to nginx;

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php [L]
</IfModule>

Already tried;

location / { try_files $uri $uri/ /index.php; }
and
if ($uri !~ "(/$|\.)"){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite /(.*) $uri/ permanent;
}
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite /. /index.php;
}
location / { try_files $uri $uri/ /index.php; }

And none works
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200627/b02384ce/attachment.htm>


More information about the nginx mailing list