From cf4bf61069681dd57bce55e8cb99232b912ea1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 24 Apr 2020 16:47:31 +0200 Subject: [PATCH] Add url rewrites --- conf/nginx.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index e55f050..56d6c10 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,6 +9,15 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } + rewrite "^__PATH__/([a-zA-Z0-9-]+)$" "__PATH__/studs.php?poll=$1"; + rewrite "^__PATH__/([a-zA-Z0-9-]+)/action/([a-zA-Z_-]+)/(.+)$" "__PATH__/studs.php?poll=$1&$2=$3"; + rewrite "^__PATH__/([a-zA-Z0-9-]+)/vote/([a-zA-Z0-9]{16})$" "__PATH__/studs.php?poll=$1&vote=$2"; + + # Admin requires the private poll ID, 24-char long + rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin$" "__PATH__/adminstuds.php?poll=$1"; + rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin/vote/([a-zA-Z0-9]{16})$" "__PATH__/adminstuds.php?poll=$1&vote=$2"; + rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin/action/([a-zA-Z_-]+)(/(.+))?$" "__PATH__/adminstuds.php?poll=$1&$2=$4"; + index index.php; try_files $uri $uri/ /index.php; location ~ [^/]\.php(/|$) {