Skip to content
This repository has been archived by the owner on Feb 23, 2019. It is now read-only.

Fix page cache .htaccess for Windows #490

Merged
merged 2 commits into from
May 21, 2017
Merged

Fix page cache .htaccess for Windows #490

merged 2 commits into from
May 21, 2017

Conversation

nigrosimone
Copy link
Collaborator

@nigrosimone nigrosimone commented May 21, 2017

On Windows OS the .htaccess section for page cache core module has a wrong path into the rule:

RewriteCond "%{DOCUMENT_ROOT}C:/DevEnv/htdocs/www.wordpress.local/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f

this happened because w3tc into the .htaccess generation for page cache rules works in a linux style only.

the fix is transform the windows path in a linux path style

$document_root = str_replace('\\', '/', Util_Environment::document_root());

this fix the issue and now the rule is right:

RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f

@nigrosimone nigrosimone merged commit fb86700 into v0.9.5.x May 21, 2017
@nigrosimone nigrosimone deleted the win-pgcache branch May 21, 2017 17:09
Furniel added a commit that referenced this pull request Dec 24, 2017
* Fix for windows: make the $document_root in linux style
Furniel added a commit that referenced this pull request Jul 3, 2018
* Fix for windows: make the $document_root in linux style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant