keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

Version 1.8+ on IIS #291

Closed mmojadad closed 3 years ago

mmojadad commented 3 years ago

Hello Cache for Homepage not generate after upgrade to version 1.8.3 , I tested on IIS, Two different server, The issue just happen on homepage and of course Webp version also not serve.

Regards,

coreykn commented 3 years ago

To troubleshoot this issue, can you please send over the Site Health Info for that site along with the direct URL to the website in reference (like done #288)? In this case, providing a screenshot of your Cache Enabler settings would also be helpful.

mmojadad commented 3 years ago

@coreykn Done!

coreykn commented 3 years ago

Thanks @mmojadad for all of your assistance with troubleshooting this issue. You've been awesome! Updating this thread to share what was happening.

This issue occurred due to the web.config file having the following set and the update in PR #260 to the Cache_Enabler_Engine::is_index() method:

<defaultDocument>
    <files>
        <clear />
        <add value="Index.php" />
    </files>
</defaultDocument>

The file stored on the server was named "index.php" and not "Index.php". As far as I know Windows file names are not case sensitive unless set otherwise. However, the large majority of servers that Cache Enabler is installed on are. That is why when introducing the CACHE_ENABLER_INDEX_FILE constant in 1.8 we no longer force the $_SERVER['SCRIPT_NAME'] value to be lowercase:

To fix this the "Index.php" value was updated to "index.php" instead:

<defaultDocument>
    <files>
        <clear />
        <add value="index.php" />
    </files>
</defaultDocument>

I think this is more of an installation issue, but if this becomes an issue for anyone else on an IIS server please let me know and we can make a change.