在nginx中wordpress实现友好url的重写方法

下面介绍2种方法实现对wordpress的 URLs 的可读性和对搜索引擎的友好

  1. 使用重写方式

    location / {
        index index.php;
        if (!-e $request_filename){
            rewrite ^ /index.php?q=$uri&$args;
        }
    }
  2. 基于try_files的url重置

    location / {
      index index.php;
      try_files $uri $uri/ /index.php?q=$uri&$args;
    }
    

Leave a Reply