Php 子目录中的symfony多语言问题

Php 子目录中的symfony多语言问题,php,symfony,nginx,Php,Symfony,Nginx,当尝试访问我的symfony 5生产环境时,我遇到了语言重定向问题。它会自动重定向到: mydomain.com/en 而不是mydomain.com/subdirectory/en 我试图更新config/packages/security.yaml文件 access_control: - { path: ^/subdirectory/(%app_locales%)/(register|login), roles: IS_AUTHENTICATED_ANONYMOUSLY } - { p

当尝试访问我的symfony 5生产环境时,我遇到了语言重定向问题。它会自动重定向到: mydomain.com/en 而不是mydomain.com/subdirectory/en

我试图更新config/packages/security.yaml文件

 access_control:
 - { path: ^/subdirectory/(%app_locales%)/(register|login), roles: IS_AUTHENTICATED_ANONYMOUSLY }
 - { path: ^/subdirectory/(%app_locales%)/admin, roles: ROLE_USER }
我想我必须在别处指定自动检测语言重定向,但我找不到它

我的Symfony应用程序正在与wordpress前端共享一个conf文件

目录是:

Wordpress: /home/mydomain/web/mydomain.com/public_html/wordpress-front/
Symfony: /home/mydomain/web/mydomain.com/public_html/app/public
这是nginx配置文件

upstream php {
        server unix:/tmp/php-cgi.socket;
        server 127.0.0.1:9003;
}
server {
    listen      xxx.xxx.xxx.xxx:443 ssl http2;
    server_name mydomain.com www.mydomain.com;
    ssl_certificate         /home/mydomain/conf/web/ssl.mydomain.com.crt;
    ssl_certificate_key     /home/mydomain/conf/web/ssl.mydomain.com.key;
    
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    root        /home/mydomain/web/mydomain.com/public_html/wordpress-front/;
    index index.php index.php index.html;
    
    access_log  /home/mydomain/web/mydomain.com/logs/mydomain.com.access.log combined;
    access_log  /home/mydomain/web/mydomain.com/logs/mydomain.com.accesslog.bytes bytes;
    error_log   /home/mydomain/web/mydomain.com/logs/mydomain.com.error.log error;

    # restrict access to hidden files, just in case
    location ~ /\. {
        deny all;
    }

    set $symfonyRoot /home/mydomain/web/mydomain.com/public_html/app/public;
    set $symfonyScript index.php;
    set $subAlias mydomainapp;
    
    location /mydomainapp {
        root $symfonyRoot;
        rewrite ^mydomainapp(.*)$ /index.php/$1 break;
        try_files $uri @symfonyFront;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

   
  # This is for the Symfony application
    location @symfonyFront {
        
        
        fastcgi_param APP_ENV prod;
        
        fastcgi_pass 127.0.0.1:9003;
        include /etc/nginx/fastcgi_params;
        
        fastcgi_param SCRIPT_FILENAME $symfonyRoot/$symfonyScript;
        fastcgi_param SCRIPT_NAME /$subAlias/$symfonyScript;
        fastcgi_param REQUEST_URI /$subAlias$uri?$args;
        
        fastcgi_index index.php;
    }

  # This is for the wordpress app
    location ~ \.php {
        fastcgi_pass 127.0.0.1:9003;
        fastcgi_index index.php;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param REQUEST_URI $uri?$args;
        include /etc/nginx/fastcgi_params;
    }
        location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }
    
    include     /home/mydomain/conf/web/nginx.mydomain.com.conf*;
}