首页 > 建站‧营销

htaccess to nginx converter~Apache伪静态规则转换为Nginx规则


Apache伪静态规则如下:

 <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

转换后的Nginx规则如下:

# nginx configuration by winginx.com

location ~ ^/index\.html$ { }

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

转换工具推荐:https://winginx.com/en/htaccess;

本文链接:https://www.zhanque.net/cms/3022.html