Automattic / Automattic/wp-super-cache
Wrong double slash rules in mod_rewite rules in Super Cache
- Dominant language
- PHP
- Stars
- 436
- Forks
- 130
- Avg merge
- 15h 11m
- Merged PRs (30d)
- 10
Description
### Impacted plugin
Super Cache
### Quick summary
Super Cache writes rewrite rules in .htaccess for Apache. It seems to handle case for trailing slashes and double slashes in Request_URI with these rules:
```
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
```
However in Apache, the REQUEST_URI variable is converted to single slashes by default.
To check double slashes, you need to use `%{THE_REQUEST}`
### Steps to reproduce
- Check if a page is cached by checking the cached file location.
- Load the page from a browser with browser caches clear.
- Check that the page is not redirected.
### A clear and concise description of what you expected to happen.
Pages with double slash should be redirected to one with single slash
### What actually happened
No redirect happens because of the rewrite rules should have used "the_request"
### Impact
Most (> 50%)
### Available workarounds?
Yes, easy to implement
### Platform (Simple and/or Atomic)
_No response_
### Logs or notes
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the Super Cache code that writes the .htaccess rewrite rules, then reproduce the request with a double slash and inspect how Apache exposes REQUEST_URI versus THE_REQUEST. Done means the generated rules detect and redirect double-slash paths while preserving the existing trailing-slash behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache, php
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100