From 71d679d426fc08422c4630c95610dd1fd6a699f0 Mon Sep 17 00:00:00 2001 From: FoXiMao <41941990+FoXiMao@users.noreply.github.com> Date: Tue, 9 May 2023 15:21:47 +0800 Subject: [PATCH] Fix maccms rewrite configuration file error (#948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复maccms rewrite 配置文件错误导致登陆时提示ERR_TOO_MANY_REDIRECTS 重定向次数过多的问题 #### What this PR does / why we need it? #### Summary of your change #### Please indicate you've done the following: - [x] Made sure tests are passing and test coverage is added if needed. - [x] Made sure commit message follow the rule of [Conventional Commits specification](https://www.conventionalcommits.org/). - [ ] Considered the docs impact and opened a new docs issue or PR with docs changes if needed. --- cmd/server/nginx_conf/rewrite/maccms.conf | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd/server/nginx_conf/rewrite/maccms.conf b/cmd/server/nginx_conf/rewrite/maccms.conf index 3470feeba..b08325169 100644 --- a/cmd/server/nginx_conf/rewrite/maccms.conf +++ b/cmd/server/nginx_conf/rewrite/maccms.conf @@ -1,5 +1,13 @@ -rewrite ^/vod-(.*)$ /index.php?m=vod-$1 break; -rewrite ^/art-(.*)$ /index.php?m=art-$1 break; -rewrite ^/gbook-(.*)$ /index.php?m=gbook-$1 break; -rewrite ^/label-(.*)$ /index.php?m=label-$1 break; -rewrite ^/map-(.*)$ /index.php?m=map-$1 break; +if (!-e $request_filename) { + rewrite ^/index.php(.*)$ /index.php?s=$1 break; + # MacCMS要求强制修改后台文件名称 所以需要手动修改下方这条重写规则 将admin修改为你修改后的文件名即可 + rewrite ^/admin.php(.*)$ /admin.php?s=$1 break; + rewrite ^/api.php(.*)$ /api.php?s=$1 break; + rewrite ^/(.*)$ /index.php?s=$1 break; + rewrite ^/vod-(.*)$ /index.php?m=vod-$1 break; + rewrite ^/art-(.*)$ /index.php?m=art-$1 break; + rewrite ^/gbook-(.*)$ /index.php?m=gbook-$1 break; + rewrite ^/label-(.*)$ /index.php?m=label-$1 break; + rewrite ^/map-(.*)$ /index.php?m=map-$1 break; + } +try_files $uri $uri/ /index.php?$query_string; \ No newline at end of file