Different syntax in Nginx and Apache

今天发现一个 Nginx 和 Apache 看似细微却影响巨大的语法差异:

在 Apache 里重定向一个域名到另一个域名,

RewriteRule (.*) http://destination.com/$1 [r=301,l]

而在 Nginx 里,应该多加一个斜杠/,否则 $1就多了一个斜杠。

rewrite ^/(.*) http://destination.com/$1 permanent;

Leave a comment

Your email address will not be published. Required fields are marked *