• Resolved almooj-craig

    (@almooj-craig)


    Basically I just want to have static files use a different sub-domain so that cookie data isn’t transferred when the file is requested.

    It seems like the “Self-hosted / File Transfer Protocol Upload” method wants to make copies of the static files. Is there an option where it just points to static files to the subdomain without copying files? Could I just enter incorrect ftp data to keep it from copying files or just leave those fields blank. Alternatively if the subdomain was just a different virtual host entry that pointed to the same files and you did not allow overwriting would that work correctly?

    Thanks,
    Craig

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m only new to W3TC after having moved from WPSuperCahce and now running a new VPS so I can do better optimisation.

    I am interested in the Self-CDN option and wonder whether you’ve seen this article – https://seo-hacker.com/implement-selfhosted-cdn-site-speed/ ??

    I’ve implemented it on a small site myself and the static files are served by the subdomain without having to copy or transfer anything.

    Thread Starter almooj-craig

    (@almooj-craig)

    Martin,

    Thanks for the link, just what I needed. First I applied the configuration setting to a 3.6 blog. It didn’t quite work because I needed to add the new server name to the Ngnix configuration. Once that was updated it worked as expected.

    Then I made those changes to a 3.6 MU blog. That was a little tricky because you need to create a single new domain name that will be used by all the blogs, but of course there is no blog that goes with that name so when the css and js files need to be generated it just tries to do a 301 to wp-signup.php.

    So basically you need the correct blog to generate the minimized js and css files, too bad the main parent 000000 minify.php doesn’t just put css and js into the correct blog number that is based on the blog number that’s in the file= query parameter.

    Here is my solution using mod_rewrite in Apache. The subdomain that does not use cookies is similar to a.blog.somedomain.org

    <Directory "/zzz/blog/htdocs/wp-content/cache/minify">
    	RewriteEngine On
    
    	RewriteCond %{HTTP_HOST} a.blog.somedomain.org$ [NC]
    	RewriteCond %{REQUEST_URI} 000004 [NC]
    	RewriteRule .* - [E=BLOG:action.]
    	RewriteCond %{REQUEST_URI} 000006 [NC]
    	RewriteRule .* - [E=BLOG:housing.]
    	RewriteCond %{REQUEST_URI} 000007 [NC]
    	RewriteRule .* - [E=BLOG:financial.]
    	RewriteCond %{REQUEST_URI} 000008 [NC]
    	RewriteRule .* - [E=BLOG:health.]
    	RewriteRule ^(.+\.(css|js))$ https://%{ENV:BLOG}blog.somedomain.org/wp-content/plugins/w3-total-cache/pub/minify.php?file=$1 [L]
    
    	RewriteBase /wp-content/cache/minify/
    	RewriteRule /w3tc_rewrite_test$ ../../plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 [L]
    	RewriteCond %{HTTP:Accept-Encoding} gzip
    	RewriteRule .* - [E=APPEND_EXT:.gzip]
    	RewriteCond %{REQUEST_FILENAME}%{ENV:APPEND_EXT} -f
    	RewriteRule (.*) $1%{ENV:APPEND_EXT} [L]
    	RewriteRule ^(.+/[X]+\.css)$ ../../plugins/w3-total-cache/pub/minify.php?test_file=$1 [L]
    	RewriteRule ^(.+\.(css|js))$ ../../plugins/w3-total-cache/pub/minify.php?file=$1 [L]
    </Directory>

    Since there are only 4 active blogs, I did it that way. If you had a lot of blogs then using RewriteMap that searches the tables would work better.

    Thanks Again,
    Craig

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CDN: Self-hosted / File Transfer Protocol Upload’ is closed to new replies.