0

I need to run a TYPO3 website on Nginx in a subdirectory of a domain: example.com/subdir.

The website is running well for normal pages, but not for pages with tx_news-records. As soon as I call a news detail page (example.com/subdir/detailpages/slug-of-news-record.html), I get the following error:

#1537633463 OutOfRangeException

Hash not resolvable

This is my Nginx config:

location ^~/subdir {
    alias /var/www/html/subdirectory;
    disable_symlinks off;
    index index.php index.html index.htm;

    try_files $uri $uri/ @subdir;

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ~* ^/subdir/fileadmin/(.*/)?_recycler_/ {
        deny all;
    }

    location ~* ^/subdir/typo3conf/ext/[^/]+/Resources/Private/ {
        deny all;
    }
    
    location ~* ^/subdir/(fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) {
    }
}

location @subdir {
    rewrite /subdir/(.*)$ /subdir/index.php?/$1$is_args$args last;
}


location ~* ^/subdir/(.*$) {
    return 301 /subdir/$1;
}

What is missing in my Nginx config and is there something in general which I need to approve?

chris
  • 2,109
  • 2
  • 23
  • 33

1 Answers1

0

After some trial and error I found the solution myself. The following configuration is working for me:

location ^~/subdir {
    alias /var/www/html/subdirectory;
    disable_symlinks off;
    index index.php index.html index.htm;

    try_files $uri $uri/ @subdir;

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ~* ^/subdir/fileadmin/(.*/)?_recycler_/ {
        deny all;
    }

    location ~* ^/subdir/typo3conf/ext/[^/]+/Resources/Private/ {
        deny all;
    }
    
    location ~* ^/subdir/(fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) {
    }
}

location @subdir {
    rewrite /subdir/(.*)$ /subdir/index.php?$args last;
}


location ~* ^/subdir/(.*$) {
    return 301 /subdir/$1;
}

As always, it was just a tiny little change.

location @subdir {
    rewrite /subdir/(.*)$ /subdir/index.php?/$1$is_args$args last;
}

Changed to

location @subdir {
    rewrite /subdir/(.*)$ /subdir/index.php?$args last;
}
chris
  • 2,109
  • 2
  • 23
  • 33