简体   繁体   中英

convert apache rewrite rule to nginx

Can you help to covert these rewrites?

 RewriteEngine On
 RewriteBase /         
 RewriteCond %{REQUEST_URI} !^(payment|admin|provider|partner)/
 RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteRule ^(.*)$ dispatcher.php [L]

I tried some online converted and they do not work.

Try:

location ~ (payment|admin|provider|partner)/ { 

} 
location / { 
  if (!-e $request_filename) { 
    rewrite ^(.*)$ /dispatcher.php break; 
  } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM