Apache: set max-age or expires in .htaccess for directory

后端 未结 2 868
傲寒
傲寒 2020-12-10 14:16

I have a handful of directories with content which will never change.

Is it possible to create .htaccess file which tells the browser that anything in this direc

2条回答
  •  生来不讨喜
    2020-12-10 14:38

    FYI, if you do what is mentioned above and your Apache won't restart then you may be getting this error:

    The Apache service named  reported the following error:
    >>> Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration.
    

    You can find that error by clicking "Start", type in "Computer Management", launch it, in the tree open "Event Viewer -> Windows Logs -> Application". That's where I found the error above.

    Easy fix, just uncomment this line in httpd.conf:

    #LoadModule expires_module modules/mod_expires.so
    

提交回复
热议问题