2
0
Эх сурвалжийг харах

[Nginx] Avoid php extensions, use rewrite

André 7 жил өмнө
parent
commit
2f18eb5ad0

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

@@ -50,6 +50,18 @@ server {
   absolute_redirect off;
   absolute_redirect off;
   root /web;
   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/(.*)$ {
   location ~ ^/api/v1/(.*)$ {
     try_files $uri $uri/ /json_api.php?query=$1;
     try_files $uri $uri/ /json_api.php?query=$1;
   }
   }