maccms重定向次数过多

maccms重定向次数过多如题问题 maccms 搭建好了 但是进入后台遇到重定向次数过多的问题 其实 maccms 官方已经给出了解决方案 如下 1 确认空间支持 rewrite 组件 2 按照伪静态 rewrite 目录下的说明文档操作 3 后台设置浏览模式为 rewrite 伪静态 如果使用 rewrite 伪静态模式 请注意把配置文件复制到网站根目录 如果静态文件后缀配置的不是 html 则请把 re

如题问题,maccms搭建好了,但是进入后台遇到重定向次数过多的问题。

 

其实maccms官方已经给出了解决方案,如下。

 

iis6.x   下使用 httpd.ini

iis7.x   下使用web.config

 

我用的阿里云服务器,用的是nginx,所以把在主机.conf设置里加上 include xxxxx.conf

或者加上如下内容:

if (!-e $request_filename) { rewrite ^/index.php(.*)$ /index.php?s=$1 last; rewrite ^/admin.php(.*)$ /admin.php?s=$1 last; rewrite ^/api.php(.*)$ /api.php?s=$1 last; rewrite ^(.*)$ /index.php?s=$1 last; break; }

完整conf举例:

server {
  listen 80;
  server_name yy.xx2018.cn;
  access_log /data/wwwlogs/yy.xx2018.cn_nginx.log combined;
  index index.html index.htm index.php;
  include /usr/local/nginx/conf/rewrite/none.conf;
  root /data/wwwroot/default/maccms;
  if (!-e $request_filename) {
        rewrite ^/index.php(.*)$ /index.php?s=$1 last;
        rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;
        rewrite ^/api.php(.*)$ /api.php?s=$1 last;
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
   }
  #error_page 404 = /404.html;
  #error_page 502 = /502.html;
  
  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}

 

修改完了conf之后,一定要重启nginx,否则是不会生效的。

service nginx restart

好了,问题已经成功解决了。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/203285.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月19日 下午10:10
下一篇 2026年3月19日 下午10:10


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号