flatpressblog / flatpress

FlatPress is a lightweight, easy-to-set-up flat-file blogging engine.
https://flatpress.org
GNU General Public License v2.0
181 stars 58 forks source link

No green success message for correctly completed contact form/ comment form #420

Open Fraenkiman opened 3 months ago

Fraenkiman commented 3 months ago

Hello everyone, there is no green success message when the contact form/comment form is filled out correctly if FlatPress is located directly in the main document directory ($_SERVER['DOCUMENT_ROOT']). In addition, you may have to click “Send” twice for the message to be sent.

If FlatPress is located in a subdirectory, a green success message is displayed.

Conditions/ Setup: FlatPress 1.3.1 release, standard theme, only standard plugins active except accessibleantispam and prettyurls, Commentcenter=allow all comments, no Akismet active.

Apache 2.4 on Debian, Xampp on Windows

My note: I could not find out the cause. Maybe you should look at the utils_redirect() function.

My workaround: Do not leave FlatPress in $_SERVER['DOCUMENT_ROOT'], but move it to a subdirectory.

So that FlatPress appears when the domain is called, the rewrite rule in the .htaccess in $_SERVER['DOCUMENT_ROOT'] must be adjusted as follows:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^\.htaccess$ - [F]
    RewriteBase /

    RewriteCond %{REQUEST_URI} !^/subdirectory/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /subdirectory/$1
    RewriteRule ^(/)?$ subdirectory/index.php [L]
</IfModule>

With best regards Frank