diff --git a/inc/Engine/CDN/CDN.php b/inc/Engine/CDN/CDN.php index 3d0ae1399d..eaa24511a3 100644 --- a/inc/Engine/CDN/CDN.php +++ b/inc/Engine/CDN/CDN.php @@ -66,7 +66,7 @@ public function rewrite( $html ) { * @param bool $enable True to enable, false otherwise. */ if ( apply_filters( 'rocket_cdn_relative_paths', true ) ) { - $relative_path_pattern = '|\/[^/](?:[^"\')\s>]+\.[[:alnum:]]+)'; + $relative_path_pattern = '|(\.+\/|\/)[^/](?:[^"\')\s>]+\.[[:alnum:]]+)'; } $pattern = '#[("\']\s*(?(?:(?:https?:|)' . preg_quote( $this->get_base_url(), '#' ) . ')\/(?:(?:(?:' . $this->get_allowed_paths() . ')[^"\',)]+))' . $relative_path_pattern . ')\s*["\')]#i'; diff --git a/tests/Fixtures/inc/Engine/CDN/CDN/HTML/siteURL/original.html b/tests/Fixtures/inc/Engine/CDN/CDN/HTML/siteURL/original.html index 2cf1e6c401..e4a771a92f 100644 --- a/tests/Fixtures/inc/Engine/CDN/CDN/HTML/siteURL/original.html +++ b/tests/Fixtures/inc/Engine/CDN/CDN/HTML/siteURL/original.html @@ -1044,5 +1044,6 @@

Page Image Alignment