Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cache if URL has trailing slash #109

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Fix cache if URL has trailing slash #109

merged 1 commit into from
Feb 21, 2023

Conversation

howdu
Copy link
Contributor

@howdu howdu commented Feb 21, 2023

If the URL ends with a slash the explode contains an empty element at the end.

$segments = explode('/', ltrim($request->getPathInfo(), '/'));

Simple fix changing ltrim to trim

e.g: https://example.com/about-us/
VS: https://example.com/about-us

page-cache/about-us.html
page-cache/about-us/pc__index__pc.html

Nginx/apache will never read the latter.

Fixes issue: #35

@JosephSilber JosephSilber merged commit 64284cb into JosephSilber:master Feb 21, 2023
@howdu howdu deleted the patch-2 branch February 21, 2023 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants