Remove index.php from Joomla! URLs with NGINX

How to remove index.phpJoomla from my urls? For example:

http://domain.com/index.php/webpage

should become

http://domain.com/webpage

I follow some of the manuals I found, but all this leads to a redirect cycle, 404, or an internal server error. I need to be guided.

Here is my current configuration (excluding failed attempts).

server {
    listen [::]:80;
    server_name www.domain.com;
    return 301 http://domain.com$request_uri;
}

server {
    listen [::]:80;
    server_name domain.com;

    root /usr/share/nginx/www;
    index index.php index.html index.htm;

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

    location ~/favicon.ico {
        access_log off;
        log_not_found off;
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    access_log /var/log/nginx/$host-access.log;
    error_log /var/log/wpms-error.log;
}
+2
source share
1 answer

How to remove index.phpJoomla from my urls? For example: http://example.com/index.php/webpageshould become http://example.com/webpage. I followed some of the tutorials I found, but all this leads to a & hellip; redirect loop

nginx redirect loop, index.php URL-, - , , :

index index.php index.html index.htm;
if ($request_uri ~ "^/(.*)(?<=/)index\.php/?((?<=/).*)?$") {    return  301 /$1$2;  }

, index.php URL-, .

+1

Source: https://habr.com/ru/post/1606999/


All Articles