设置伪静态的时候提示无效的RewriteRules:UnrecognizedConfig

IsaacXR 2018-6-29 1299

我以前用的其它面板 Nginx 1.12的 我用的Magento商城系统, 迁到AppNode 设置伪静态的时候提示无效的RewriteRules:UnrecognizedConfig!, 这个应该怎么解决呢, 谢谢

location / {  
        index index.html index.php; ## Allow a static html file to be shown first  
        try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler  
        expires 30d; ## Assume all files are cachable  
    }  
  
    ## These locations would be hidden by .htaccess normally  
    location /app/                { deny all; }  
    location /includes/           { deny all; }  
    location /lib/                { deny all; }  
    location /media/downloadable/ { deny all; }  
    location /pkginfo/            { deny all; }  
    location /report/config.xml   { deny all; }  
    location /var/                { deny all; }  
  
    location /var/export/ { ## Allow admins only to view export folder  
        auth_basic           "Restricted"; ## Message shown in login window  
        auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword  
        autoindex            on;  
    }  
      location  /. { ## Disable .htaccess and other hidden files  
        return 404;  
    }  
  
    location @handler { ## Magento uses a common front handler  
        rewrite / /index.php;  
    }  
  
    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler  
        rewrite ^(.*.php)/ $1 last;  
    }  
最新回复 (4)
  • 虚竹 2018-6-29
    引用 2

    伪静态规则,是一种rewrite规则,只能由以下指令构成:
    if、rewrite、return、break、set、try_files。

    这和你不能在Apache的Rewrite规则文件.htaccess里乱写指令是一个道理。

    网络上的文章很多是人云亦云,误人子弟。

    根据你提供的案例中,请将以下设置为伪静态规则(严格意义上也不能算伪静态):

    try_files $uri $uri/ @handler;


    然后将剩下的指令,在“源文“设置中,点击自定义,添加到 location / {} 这个配置段之后:

    ## These locations would be hidden by .htaccess normally  
        location /app/                { deny all; }  
        location /includes/           { deny all; }  
        location /lib/                { deny all; }  
        location /media/downloadable/ { deny all; }  
        location /pkginfo/            { deny all; }  
        location /report/config.xml   { deny all; }  
        location /var/                { deny all; }  
      
        location /var/export/ { ## Allow admins only to view export folder  
            auth_basic           "Restricted"; ## Message shown in login window  
            auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword  
            autoindex            on;  
        }  
          location  /. { ## Disable .htaccess and other hidden files  
            return 404;  
        }  
      
        location @handler { ## Magento uses a common front handler  
            rewrite / /index.php;  
        }  
  • IsaacXR 2018-6-29
    引用 3
    你好, 麻烦能不能帮我修改下, 我复制过去, 本人不是伸手党, 但是确实搞不定这个东西,网上找了好多都没法用。谢谢
  • 虚竹 2018-6-29
    引用 4
    需要我们人工处理可提交工单收费处理,附上面板的临时登录链接,50元/次。
  • IsaacXR 2018-7-1
    引用 5
    虚竹 需要我们人工处理可提交工单收费处理,附上面板的临时登录链接,50元/次。
    好的, 谢谢, 暂时已经解决了, 后期有需要再联系你们。
返回
发新帖