JosephSilber / page-cache

Caches responses as static files on disk for lightning fast page loads.
MIT License
1.21k stars 118 forks source link

document suggestion for trailing slash #35

Open deepaksp opened 5 years ago

deepaksp commented 5 years ago

hi thr, great package this issue is for those who use trailing slash (like me) in thr url ! in that case default nginx configure doesnt work (i don't why)

here is nginx config

location = / {
    try_files /page-cache/pc__index__pc.html /index.php?$query_string;
}

location / {
    try_files $uri $uri/ /page-cache/$uri/pc__index__pc.html /index.php?$query_string;
}
harrisnl commented 3 years ago

@deepaksp Nice addition, I had the same issue.

When the url structure of your website has trailing slashes ( e.g. /blog/this-is-my-blog-title/ ) the plugin creates this file: /page-cache/blog/this-is-my-blog-title/pcindexpc.html so the nginx config has to be changed to the above to make the caching work as expected.