在Nginx的Joomla – 删除斜杠无法正常工作

我正在使用nginx 1.10.3来运行joomla 3.7.3,并且在清除尾部斜线时遇到了问题。 我打开了“search引擎友好的URL”,以及“使用URL重写”。

我在我的nginx conf文件中有这些东西:

server { listen 80 default_server; listen [::]:80 default_server; root /var/www/folder; index index.php index.html index.htm default.html default.htm; rewrite ^/(.+)/$ /$1 permanent; server_name 000.000.00.000; server_name_in_redirect off; location / { try_files $uri $uri/ /index.php?$args; } location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; } location ~ /\.ht { deny all; } } 

它的工作,但部分。 url如下:

http://000.000.00.000/category/当然成为http://000.000.00.000/category

但是当我尝试访问http://000.000.00.000/administrator/时 ,现在无法访问,而Chrome则显示ERR_TOO_MANY_REDIRECTS

我不知道如何解决这个问题,我也试图取代:

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

有了这个:

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

但是当我尝试访问http://000.000.00.000/administrator/时 ,服务器将我redirect到我的主页http://000.000.00.000/

请帮我弄清楚这一点。

目前rewrite发生之前,而不pipetry_files里面的location

你可以尝试把它放在一个位置,在testing静态文件后,例如

  location / { try_files $uri $uri/ @joomlaurls; } location @joomlaurls { rewrite ^/(.+)/$ /$1 permanent; try_files $uri $uri/ /index.php?$args; error_page 404 = /index.php; }