Skip to content

Use an origin pull CDN with very few lines of code - WordPress plugin

Notifications You must be signed in to change notification settings

szepeviktor/tiny-cdn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tiny CDN

Use an origin pull CDN with very few lines of code.

  • Works with custom /wp-content location
  • Does not support multisite installations @TODO wp-cdn-rewrite plugin get_rewrite_path()

Pull requests are welcome on GitHub.

Installation

This plugins has no user interface.

Set /wp-includes (optional) and /wp-content (optional) CDN URL-s in your wp-config.php.

// No trailing slash!
define( 'TINY_CDN_INCLUDES_URL', 'https://d2aaaaaaaaaaae.cloudfront.net/wp-includes' );
define( 'TINY_CDN_CONTENT_URL', 'https://d2aaaaaaaaaaae.cloudfront.net/wp-content' );

Configuration

Hook into these filters before template_redirect time.

// Disable rewriting
add_filter( 'tiny_cdn_disable', '__return_true' );

// Don't rewrite for these users
add_filter( 'tiny_cdn_capability', function () { return 'edit_pages'; } );

// This is a regular expression to exclude single files
add_filter( 'tiny_cdn_excludes', function () { return '#\.php#'; } );

Recommendations

About

Use an origin pull CDN with very few lines of code - WordPress plugin

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Languages