M
M
Miku Hatsune2015-11-18 16:10:02
Nginx
Miku Hatsune, 2015-11-18 16:10:02

How to convert apache2 mod_rewrite rules to nginx?

This is the rule:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

I need to convert it for nginx, but I don't know how. I'm new to nginx

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vlad Zhivotnev, 2015-11-18
@Hatsune-Miku

try_files $request_filename /index.php?_url=/$1;
Well, do not forget to describe the location for processing index.php.
And a question on the answer "How to transform" - nevertheless "read the documentation". Well, or re-ask the question in the spirit of "transform the rules."

A
Alexey Ukolov, 2015-11-18
@alexey-m-ukolov

www.winginx.com/en/htaccess

O
OnYourLips, 2015-11-18
@OnYourLips

It is not necessary to convert (literally, each directive).
nginx offers the try_files directive to solve such problems, it is much more elegant than such a crutch for Apache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question