Page 1 of 1

FlatPress 1.4-dev Github 1908 - PrettyUrls problems

Posted: Fri Mar 07, 2025 2:29 pm
by laborix
Test environment Nginx 1.27 and PHP 8.1.31

While testing the error with the rebuild index, a new problem with the FlatPress 1.4-dev Github 1908 appeared. PrettyUrls only works with
(*) HTTP Get
e.g. /?u=/2024/01/01/hello-world/
FlatPress comments all other PrettyUrls settings with 404 :roll:

best regards

Re: FlatPress 1.4-dev Github 1908 - PrettyUrls problems

Posted: Sat Mar 08, 2025 12:01 am
by fraenkiman
Hello Laborix,

try this or a similar configuration:

Code: Select all

server {
    listen 80;
    server_name yourdomain.com;
    root /path/to/flatpress;
    index index.php;

    # PrettyURLs-Unterstützung für FlatPress
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # Unterstützung für Path Info URLs (/index.php/2024/01/01/hello-world/)
    location ~ ^/index\.php(/.*)?$ {
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass unix:/run/php/php8.4-fpm.sock;  # Stelle sicher, dass dies zum richtigen PHP-FPM-Socket passt
    }

    # Blockiert den Zugriff auf .htaccess-Dateien
    location ~ /\.ht {
        deny all;
    }

    # Entfernt den "X-Powered-By" Header
    add_header X-Powered-By "";

    # Unterstützung für Sitemap-URLs
    rewrite ^/sitemap\.xml$ /sitemap.php last;
    rewrite ^/sitemap$ /sitemap.php last;

    # Weiterleitung aller nicht existierenden Dateien an index.php für PrettyURLs
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # PHP-Verarbeitung
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php8.4-fpm.sock;  # Passe dies an deine PHP-Version an
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
Functionality also here without guarantee.
With best regards
Frank

Re: FlatPress 1.4-dev Github 1908 - PrettyUrls problems

Posted: Sat Mar 08, 2025 10:01 am
by laborix
Please close the whole thread, PrettyUrls works if you apply the correct rewrite rule as shown in the FlatPress Wiki!
Link: https://wiki.flatpress.org/doc:plugins: ... ?s[]=nginx

Under Nginx this two prettyUrl settings work as shown in the FlatPress Wiki
(*) HTTP Get - Example: /?u=/2011/01/01/hello-world/

or

(*) Pretty - Example: /2011/01/01/hello-world/
Sorry, nothing thought :oops: