w3-total-cache fix_environment apache sets DOCUMENT_ROOT?in htaccess correctly?
-
I continued work on my website after half a year of pause. Plugin auto-updates for w3-total-cache ran ok all that time. To be sure the
.htaccess
is intact as well, I ran:$ wp w3-total-cache fix_environment apache
Which changed 2 directives in the
.htaccess
file in the configuration block# BEGIN W3TC Page Cache core
→<IfModule mod_rewrite.c>
.Before fix_environment:
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SLASH}%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SLASH}%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
After fix_environment ran:
RewriteCond "%{DOCUMENT_ROOT}/html/apps/staging.example.com/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SLASH}%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f RewriteRule .* "/html/apps/staging.example.com/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SLASH}%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L] </IfModule>
Are you sure this went correct?
My cache location:
- Relative:
~/html/apps/staging.example.com/wp-content/cache/
Old DOCUMENT_ROOT location:
Before it was the website root, equivalent to the WordPress root (wp-config.php and .htaccess reside in that very same directory), equivalent to WordPress constant ABSPATH, equivalent to this UNIX paths:
- Relative:
~/html/apps/staging.example.com/
- Absolute:
/data/web/shared-hosting-customer-number/html/apps/staging.example.com/
New DOCUMENT_ROOT location
%{DOCUMENT_ROOT}
is now my user home directory, which is way above the respective domain directory, equivalent to this UNIX paths:- Relative:
~/
- Absolute:
/data/web/shared-hosting-customer-number/
Are you sure this is right?
- If that’s intentional, fine.
- Only that as soon as some variables point higher than my domain directory root folder, I get somehow nervous… You know, cross domain access, etc… I feel better having this reported to you as a false alarm, than ignoring it.
Your recommended “Rewrite Rules (based on active settings)”
- shown at
/wp-admin/admin.php?page=w3tc_install
interestingly show the two lines in question exactly as in the old config! - Maybe the w3-total-cache fix_environment routine in the wp-cli plugin is outdated or otherwise erroneous?
- Relative:
- The topic ‘w3-total-cache fix_environment apache sets DOCUMENT_ROOT?in htaccess correctly?’ is closed to new replies.