WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
CDN/Cloudfront rewrite from the root folder (2 posts)

  1. benstrum
    Member
    Posted 1 year ago #

    Hello,

    I want to be able to rewrite starting from the root folder. I.e., I basically want to treat everything as cacheable with the exception of pages with php extensions. To do this, I updated the Include directories on the CDN tab to read as follows (notice that I simply added a set of commas:

    wp-content,wp-includes,files,,

    This worked for almost everything except for the home page link. Obviously, the format for that link is something like this: http://www.mysite.com/. How do I get get the home url to be included in the rewrite?

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. csmicfool
    Member
    Posted 1 year ago #

    I tried this:

    /**
     * Rewriter of URLs, used as replace-callback.
     *
     * Called by #scossdl_off_filter.
     */
    function scossdl_off_rewriter($match) {
    	global $ossdl_off_blog_url, $ossdl_off_cdn_url, $arr_of_excludes, $arr_of_cnames, $ossdl_https;
    
    	if ( $ossdl_off_cdn_url == '' )
    		return $match[0];
    
    	if ( $ossdl_https && substr( $match[0], 0, 5 ) == 'https' )
    		return $match[0];
    
    	if ( false == in_array( $ossdl_off_cdn_url, $arr_of_cnames ) )
    		$arr_of_cnames[] = $ossdl_off_cdn_url;
    
    	if ( scossdl_off_exclude_match( $match[0], $arr_of_excludes ) ) {
    		return $match[0];
    	} else {
    		$include_dirs = scossdl_off_additional_directories();
    
    		//Removed condition to test case Ben described
    		$offset = scossdl_string_mod($match[1], count($arr_of_cnames));
    		return str_replace($ossdl_off_blog_url, $arr_of_cnames[$offset], $match[0]);
    
    		/*if ( preg_match( '/' . $include_dirs . '/', $match[0] ) ) {
    			$offset = scossdl_string_mod($match[1], count($arr_of_cnames));
    			return str_replace($ossdl_off_blog_url, $arr_of_cnames[$offset], $match[0]);
    		} else {
    			return $match[0];
    		}*/
    	}
    }

    However, this did not affect links generated by the home_url() function.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.