#rewrite .* /index.php last;
rewrite ^/(.*)$ /index.php/ last;
Of these two lines of code, the previous line can be used normally, but the following line will report an error as soon as it is used. Why? ? Is there any configuration that needs to be enabled? I looked at the documentation and couldn't find it. . .
曾经蜡笔没有小新2017-05-16 17:22:17
rewrite ^/(.*)$ /index.php/ last;
中 代表的是
^/(.*)$
正则捕获的内容,也就是(.*)
What was captured.
^/(.*)$
中^/
表示已/
开头,.
表示匹配除换行符以外的任意字符,*
表示重复0次或更多次,$
表示匹配字符串的结束,()
means capturing (matching) content.The content in parentheses
()
之间匹配的内容,可以在后面通过来引用,
表示的是前面第二个
()
.
That is, when a request link is /test
,就会被重写为/index.php/test
并重定向到/index.php/test
,所以请确保有这样的资源地址 /index.php/test
伊谢尔伦2017-05-16 17:22:17
Use nginx -t
to test whether the configuration is correct.
500 error. Looking at the ErrorLog will usually tell you the reason