Issue
Enabling Max Cache for Moodle sites and Slash Arguments break (Path Info) and returns a 404 error
Environment
- MAx Cache
- cPanel
- Moodle 5.x
Solution
Use .htaccess file to exclude PATH_INFO-style URLs from MAx Cache and only cache plain pages:
<IfModule maxcache_module>
MaxCache On
# Don’t cache Moodle slash-argument URLs
MaxCacheExcludeURI "^/index\.php/"
# Don’t cache common dynamic Moodle areas
MaxCacheExcludeURI "^/(admin|auth|backup|blog|calendar|course|enrol|file|lib|login|message|mod|my|report|user|webservice)(/|$)"
# Optional: exclude logged-in users and session-based pages
MaxCacheExcludeCookie "(MoodleSession|_moodle_session|logged_in)"
# Cache only safe public pages
MaxCachePath /moodlecache/{HTTP_HOST}{REQUEST_URI}/index{SSL_SUFFIX}.html
</IfModule>Note: moodlecache in MaxCachePath is just an example cache location, so please use a directory that exists and is writable.
Cause
Moodle specific MAx Cache config required
Useful links
https://docs.cloudlinux.com/cloudlinuxos/shared-pro/#max-cache-documentation
Comments
0 comments
Please sign in to leave a comment.