Search code examples
xamppmod-expires

XAMPP how to load mod_expires


I have XAMPP, and I can see the file mod_expires.so under path

...XAMPP\apache\modules\mod_expires.so

However, I believe the module is not loading for two reasons:

first: mod_expires is not listed when call phpinfo()

second, is I add cache timelines to .htaccess file I get 500 server error

(EXAMPLE OF cache code inside .htaccess

<IfModule mod_expires.c>
# Activate mod_expires for this directory
ExpiresActive on
#HTML documents are good for a week from the time they were changed
ExpiresDefault M604800 
</IfModule>

TWO QUESTIONS THEN:

Is the presence of the mod_expires.so file indicative that the module is installed?

If YES, how do I enable or activate?

If NOT, how do I install and enable in XAMPP?

Thank you,


Solution

  • To load the expires module, assuming that it is part of the XAMPP package, we need to un-comment the LoadModule from apache's configuration file.

    First check that XAMPP package has the module:

    go to C:\XAMPP\apache\module and look for file mod_expires.so

    If you have this file, go to file C:\XAMPP\apache\conf\httpd.conf and search for "mod_expires.so"

    You will see

    #LoadModule expires_module modules/mod_expires.so
    

    un-comment this line so as to have

    LoadModule expires_module modules/mod_expires.so
    

    Reset the server