用Nginx重写Symfony路由

问题描述

我想将Symfony的旧路线/ edit-article / {guid}重写为新路线 / article / {guid} / edit。

添加到服务器{}

rewrite ^/edit-article/(.*)$ /aricle/$1/edit last;

但是它不起作用。

我的朋友。

server {
    root /srv/app/public;
    client_max_body_size 500M;

    rewrite ^/edit-article/(.*)$ /aricle/$1/edit last;

    location / {
        client_max_body_size 500M;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        client_max_body_size 500M;
        rewrite ^(.*)$ /index.PHP/$1 last;
    }


    location ~ ^/(app|app_dev|config|index)\.PHP(/|$) {
        client_max_body_size 500M;
        fastcgi_pass PHP:9000;
        fastcgi_split_path_info ^(.+\.PHP)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
    }

    location ~ \.PHP$ {
      return 404;
    }

    error_log /var/log/Nginx/symfony_error.log;
    access_log /var/log/Nginx/symfony_access.log;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)