FlatPress 1.4-dev Github 1908 - PrettyUrls problems

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
laborix
Posts: 151
Joined: Sat Feb 16, 2019 3:51 pm

FlatPress 1.4-dev Github 1908 - PrettyUrls problems

Post by laborix » Fri Mar 07, 2025 2:29 pm

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

User avatar
fraenkiman
Posts: 311
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: FlatPress 1.4-dev Github 1908 - PrettyUrls problems

Post by fraenkiman » Sat Mar 08, 2025 12:01 am

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
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

laborix
Posts: 151
Joined: Sat Feb 16, 2019 3:51 pm

Re: FlatPress 1.4-dev Github 1908 - PrettyUrls problems

Post by laborix » Sat Mar 08, 2025 10:01 am

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:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 44 guests