Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • I was just searching for a proper CDN plugin for wordpress and stumbled upon this thread as I regularly use the Bedrock development stack (https://roots.io/bedrock/). This stack uses the WordPress core as a Composer depency and thus keeps it in a subdirectory inside the docroot with a structure like this:

    Document root: /
    Wordpress Core: /wp
    Wordpress Content: /app

    The siteurl should never be used to access the wordpress root to reference the content dir, as it just points to the core files, but not necessarily to the root. Using home would not necessarily point to the name of the WordPress core dir, thus this would also not be a complete approach. I think the site_url has to be used in connection with the content dir, which can be accessed via the content_url() function separately.

    With this I just wanted to point out that having the wordpress core in a subdir is not an uncommon usecase indicated by over 2000 Github stars for Bedrock and I am totally looking forward to this being integrated into CDN enabler.

    Thanks a lot in advance!

    Eric

    Thread Starter ericstumper

    (@ericstumper)

    I have just seen your reply, must have been still typing while you submitted it. Thanks for your answer. Could you please add my last post to the support ticket?

    Thanks in advance ??

    Thread Starter ericstumper

    (@ericstumper)

    So I spend some time searching the corresponding lines.

    I added this at line 520 in wfCache.php:

    $contentUrl = parse_url(content_url());
    $contentUrl = $contentUrl['path'];

    And replaced lines 562 and 563:

    RewriteCond "%{DOCUMENT_ROOT}{$pathPrefix}/wp-content/wfcache/%{HTTP_HOST}_%1/%2~%3~%4~%5~%6_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" -f
    RewriteRule \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$ "{$pathPrefix}/wp-content/wfcache/%{HTTP_HOST}_{$matchCaps}_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" [L]

    with:

    RewriteCond "%{DOCUMENT_ROOT}{$contentUrl}/wfcache/%{HTTP_HOST}_%1/%2~%3~%4~%5~%6_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" -f
    RewriteRule \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$ "{$contentUrl}/wfcache/%{HTTP_HOST}_{$matchCaps}_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" [L]

    I haven’t tested yet whether this is safe for all kinds of wordpress environments though.

Viewing 3 replies - 1 through 3 (of 3 total)