在在线.htaccess转nginx工具将常见 Rewrite 与配置指令转换为 Nginx 写法。 粘贴 .htaccess 规则 RewriteEngine On RewriteBase / DirectoryIndex index.html index.php ErrorDocument 404 /404.html Options -Indexes Header set X-Frame-Options SAMEORIGIN RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] RewriteRule ^article/([0-9]+)\.html$ index.php?id=$1 [L] 开始转换 清空 Nginx 配置(放入 server { } 中) 复制