.htaccess

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

.htaccess

Zonimi
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
 

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: .htaccess

Francis Daly
On Sat, Jun 27, 2020 at 06:49:51PM -0300, Zonimi wrote:

Hi there,

> 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>

Can you describe how you want requests to be handled? It's not immediately
clear to me what that apache config is trying to do.

> Already tried;
>
> location / { try_files $uri $uri/ /index.php; }

That looks like it is probably the "standard" close-enough equivalent;
but obviously some part of it does not work in this case.

> And none works

What request do you make?
What response do you get?
What response do you want to get instead?

Thanks,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx