How to convert apache rewrite to nginx rewrite
迷茫
迷茫 2017-05-16 17:03:01
0
2
618

I am a newbie. I would like to know how to convert apache rewrite to nginx. For example, how to convert the following apache rules:

 <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteCond %{REQUEST_URI} !dispatch\.php$
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule .* dispatch.php [L,QSA]
 </IfModule>
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
世界只因有你

It’s simple. Understand your Apache httpd rules, and then write its functions using nginx rules. It’s almost the same thing as translation.

Your rule means that if the accessed URI does not end with dispatch.php and the accessed file does not exist, then it will be redirected to dispatch.php. You can write this directly in nginx:

try_files $uri /dispatch.php;
小葫芦

Apache Rewrite转Nginx Rewrite

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template