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

improve trailing slash handling #85

Closed coreykn closed 4 years ago

coreykn commented 4 years ago

In some cases when a page is requested without a trailing slash (e.g. https://www.example.com/about) the cached file is returned instead of bypassing the cache to allow a redirect to a location with the trailing slash appended (e.g. https://www.example.com/about/).

Bypassing the cache to allow a redirect when a request to a page is missing the trailing slash, as WordPress currently does by default, was introduced to the Cache Enabler plugin in version 1.2.3 and added to in 1.3.1.

WordPress topic: https://wordpress.org/support/topic/do-not-cache-redirect-pages/

coreykn commented 4 years ago

Add logic for if trailing slash is removed on purpose (e.g. custom structure https://www.example.com/%postname%). If a page is requested with a trailing slash (e.g. https://www.example.com/about/) bypass the cache to allow a redirect to a location without the trailing slash (e.g. https://www.example.com/about).

WordPress topic: https://wordpress.org/support/topic/url-without-or-without-the-trailing-slash-both-get-rendered/