Page 1 of 1

FlatPress Github 3232 - Windows Server 2019, IIS 10, MS URL Rewrite Plugin and PHP 8.5.5

Posted: Sat Apr 25, 2026 6:07 pm
by laborix
Quick&dirty test with installation, change language to German and switch back to the original FlatPress Theme from 2006 work fine :D

Ok, in the Admin Center, under Plugins, on the SEO tab, the following error appears under "SEO robots.txt":

Code: Select all

Warning: Undefined array key "cantsave" in ...\fp3232\fp-content\compile\e93fccb09cf8b04111b9595da102f3f4^23ec2ea538c9b842ceca91f77739d03ac765b0a3_0.plugin_seometataginfoadmin.plugin.seometataginfo.php on line 52
PrettyUrls is currently running in automatic mode because there are currently issues converting the FlatPress default .htaccess file to a web.config file for IIS 10.0 :roll:
Once that is done, I will test the PrettyUrls options from the FlatPress GitHub repository (version 3232 or higher) on the Windows Server with IIS.

Have a nice Weekend...

Re: FlatPress Github 3232 - Windows Server 2019, IIS 10, MS URL Rewrite Plugin and PHP 8.5.5

Posted: Sat Apr 25, 2026 6:54 pm
by laborix
Quick question:
Is it possible that FlatPress doesn't care about web.config at all? In other words, does FlatPress have no idea what it is?

Here is a converted web.config for IIS 10.0:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="FlatPress Rewrite" stopProcessing="true">
          <match url=".*" ignoreCase="true" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="/flatpress/index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
No matter what I try in the FlatPress Administration, the
( ) Pretty
Beispiel: /2024/01/01/hello-world/
remains completely grayed out? Or am I making a mistake?
Auf Deutsch: Hab ich einen Denkfehler?!?

regards

Re: FlatPress Github 3232 - Windows Server 2019, IIS 10, MS URL Rewrite Plugin and PHP 8.5.5

Posted: Sun Apr 26, 2026 2:00 pm
by laborix
Ok, FlatPress GitHub 3232, the .htaccess file from the FlatPress Wiki and convert it to the IIS 10.0 web.config. You should listen to Microsoft and do what Microsoft says. IIS 10.0 includes a built-in .htaccess converter that converts .htaccess files for each domain, subdomain or web folder into a corresponding web.config file and saves them to the correct folder at the same time.

Here the converted web.config:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Importierte Regel 1">
                    <match url="^\.htaccess$" ignoreCase="false" />
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                </rule>
                <rule name="Importierte Regel 2">
                    <match url="^([^/]+)/$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="{R:1}.php" />
                </rule>
                <rule name="Importierte Regel 3">
                    <match url="^([^/]+)/([^/]+)/$" ignoreCase="false" />
                    <action type="Rewrite" url="/{R:1}/{R:2}.php" />
                </rule>
                <rule name="Importierte Regel 4" stopProcessing="true">
                    <match url="(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{URL}" pattern="(\.[a-zA-Z0-9]{1,5}|/)$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Redirect" url="/{R:1}/" redirectType="Permanent" />
                </rule>
                <rule name="Importierte Regel 5" stopProcessing="true">
                    <match url="^images/(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/fp3232/fp-content/images/{R:1}" />
                </rule>
                <rule name="Importierte Regel 6" stopProcessing="true">
                    <match url="^attachs/(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="/fp3232/fp-content/attachs/{R:1}" />
                </rule>
                <rule name="Importierte Regel 7" stopProcessing="true">
                    <match url="^.*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/fp3232/index.php" appendQueryString="true" />
                </rule>
                <rule name="Importierte Regel 8" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{SERVER_PORT}" pattern="^443$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

With this web.config FlatPress GitHub 3232 now works with PrettyURLs, actually with all three PrettyURLs options. To test this, posts were imported from various backups, the FlatPress index was rebuilt, the cache was cleared and the site was tested. No PHP 8.5 errors in the log; it appears that FlatPress is stable under PHP 8.5.

Ok, aside from the SEO robots.txt PHP error in the other post above.

regards

Re: FlatPress Github 3232 - Windows Server 2019, IIS 10, MS URL Rewrite Plugin and PHP 8.5.5

Posted: Sun Apr 26, 2026 2:30 pm
by fraenkiman
laborix wrote: Sat Apr 25, 2026 6:54 pm Quick question:
Is it possible that FlatPress doesn't care about web.config at all? In other words, does FlatPress have no idea what it is?
Hello laborix,

As far as I recall, FlatPress has never taken the web.config file into account. FlatPress has never performed XML validation on the web.config file. I have also never encountered live, public web hosts running on IIS. The question is whether a code change is worth it given that IIS has a market share of less than 4%, and the trend is downward. Testing under real-world conditions is therefore nearly impossible.

FlatPress is also more of a niche project. So I estimate the chance that FlatPress is running on a publicly accessible IIS server to be very low.

However, in your test, you can simply create an .htaccess file with the PrettyURLs plugin in the FP root, since IIS ignores this file anyway. This then signals to the plugin that the server supports rewrite rules.

It might make sense to simply document the .htaccess trick in the wiki.

I’ve fixed the SEO plugin with the missing $plang.cantsave key. Thank you very much.

Best regards,
Frank

Re: FlatPress Github 3232 - Windows Server 2019, IIS 10, MS URL Rewrite Plugin and PHP 8.5.5

Posted: Sun Apr 26, 2026 2:39 pm
by fraenkiman
laborix wrote: Sun Apr 26, 2026 2:00 pm Here the converted web.config:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Importierte Regel 1">
                    <match url="^\.htaccess$" ignoreCase="false" />
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                </rule>
                <rule name="Importierte Regel 2">
                    <match url="^([^/]+)/$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="{R:1}.php" />
                </rule>
                <rule name="Importierte Regel 3">
                    <match url="^([^/]+)/([^/]+)/$" ignoreCase="false" />
                    <action type="Rewrite" url="/{R:1}/{R:2}.php" />
                </rule>
                <rule name="Importierte Regel 4" stopProcessing="true">
                    <match url="(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{URL}" pattern="(\.[a-zA-Z0-9]{1,5}|/)$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Redirect" url="/{R:1}/" redirectType="Permanent" />
                </rule>
                <rule name="Importierte Regel 5" stopProcessing="true">
                    <match url="^images/(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/fp3232/fp-content/images/{R:1}" />
                </rule>
                <rule name="Importierte Regel 6" stopProcessing="true">
                    <match url="^attachs/(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="/fp3232/fp-content/attachs/{R:1}" />
                </rule>
                <rule name="Importierte Regel 7" stopProcessing="true">
                    <match url="^.*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/fp3232/index.php" appendQueryString="true" />
                </rule>
                <rule name="Importierte Regel 8" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{SERVER_PORT}" pattern="^443$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

With this web.config FlatPress GitHub 3232 now works with PrettyURLs, actually with all three PrettyURLs options. To test this, posts were imported from various backups, the FlatPress index was rebuilt, the cache was cleared and the site was tested. No PHP 8.5 errors in the log; it appears that FlatPress is stable under PHP 8.5.
Would you like to expand the wiki article?

Re: FlatPress Github 3232 - Windows Server 2019, IIS 10, MS URL Rewrite Plugin and PHP 8.5.5

Posted: Sun Apr 26, 2026 7:33 pm
by laborix
fraenkiman wrote: Sun Apr 26, 2026 2:30 pm... However, in your test, you can simply create an .htaccess file with the PrettyURLs plugin in the FP root, since IIS ignores this file anyway. This then signals to the plugin that the server supports rewrite rules. ...
Thank you for pointing that out, as a result, everything regarding FlatPress and IIS is now changing :o


PrettyURLs Test Basics in the Admin Interface:

Option 1: Path Info = Beispiel: /index.php/2024/01/01/hello-world/
Option 2: HTTP Get = Beispiel: /?u=/2024/01/01/hello-world/
Option 3: Pretty = Beispiel: /2024/01/01/hello-world/


PrettyURLs Advanced Test on IIS 10.0

IIS Test 1:
FlatPress clean installation without .htaccess and web.config
Only PrettyUrls options 1 and 2 work, option 3 is grayed out

IIS Test 2:
FlatPress without .htaccess, but this time with web.config.
As in IIS Test 1, PrettyUrls options 1 and 2 work, option 3 is grayed out

IIS Test 3:
FlatPress with default .htaccess and web.config
All PrettyURL options 1, 2 and 3 work

IIS Test 4, pointless, but just for fun:
FlatPress with a blank empty .htaccess file and no web.config
PrettyURL options 1, 2, and 3 can be selected in the admin interface, but PrettyURL option 3 generates 404 errors.

IIS Test 5, Final Test:
FlatPress with the default .htaccess file, but without web.config
PrettyURL options 1, 2, and 3 can be selected in the admin interface, but PrettyURL option 3 also generates a 404 error.

Conclusion:
To get FlatPress working properly on a Windows Server with IIS both files, the .htaccess and the web.config files, are required for PrettyUrls option 3 to function.

It seems to me that I'm always learning something new at FlatPress :roll: