沉冰浮水

沉冰浮水

做最终到的事,成为最终成为的人!
github
bilibili
mastodon
zhihu
douban

Nginx 下二级目录伪静态的标准姿势

Hello World

# 子目录规则要排在前边;
location /sub/ {
  if (-f $request_filename/index.html) {
    rewrite (.*) $1/index.html break;
  }
  if (-f $request_filename/index.php) {
    rewrite (.*) $1/index.php;
  }
  if (!-f $request_filename) {
    rewrite (.*) /sub/index.php;
  }
}
# 根目录规则
location / {
  if (-f $request_filename/index.html) {
    rewrite (.*) $1/index.html break;
  }
  if (-f $request_filename/index.php) {
    rewrite (.*) $1/index.php;
  }
  if (!-f $request_filename) {
    rewrite (.*) /index.php;
  }
}
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.