소스 검색

[Nginx] Avoid php extensions, use rewrite

André 7 년 전
부모
커밋
2f18eb5ad0
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      data/conf/nginx/site.conf

+ 12 - 0
data/conf/nginx/site.conf

@@ -50,6 +50,18 @@ server {
   absolute_redirect off;
   root /web;
 
+  location / {
+    try_files $uri $uri/ @strip-ext;
+  }
+
+  location /edit {
+    rewrite ^/edit/(.*)/(.*) /edit.php?$1=$2;
+  }
+
+  location @strip-ext {
+    rewrite ^(.*)$ $1.php last;
+  }
+
   location ~ ^/api/v1/(.*)$ {
     try_files $uri $uri/ /json_api.php?query=$1;
   }