Welcome! Log In Create A New Profile

Advanced

Re: Rewrite .htaccess on nginx

Francis Daly
September 01, 2020 06:38PM
On Tue, Sep 01, 2020 at 03:34:33PM -0400, Jorge Enrique Diaz wrote:

Hi there,

> i want to do this in nginx
>
> Options All -Indexes
> RewriteEngine on
>
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

That is approximately "try_files $uri $uri/ /index.php?url=$uri;", which
would appear inside a location{}; and there would also be (probably)
something involving fastcgi_pass for handling the "php" requests.

http://nginx.org/r/try_files for the try_files documentation, and similar
urls for any other directives used.

> http {

> location / {

http://nginx.org/r/location

"location" cannot be directly inside "http"; it must be inside "server".

> NGINX EMERG LOCATION IS NOT ALLOWED HERE IN
> C.\LARAGON\BIN\NGINX\NGINX1.14.0/CONF/NGINX.CONF:37

That is reporting that "location" cannot be directly inside "http".

Probably the simplest is to start with whatever initial config file
your system has, and see what "location" block inside a "server" block
is used to handle a test request. Then adjust that "location", or add
a new one beside it, for your testing.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite .htaccess on nginx

Jorge Enrique Diaz September 01, 2020 03:34PM

Re: Rewrite .htaccess on nginx

Francis Daly September 01, 2020 06:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 85
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready