Skip to content

Commit

Permalink
Fix undefined WPR_WEBP env var
Browse files Browse the repository at this point in the history
Co-authored-by: Roy Orbitson <[email protected]>
  • Loading branch information
dvershinin and Roy-Orbison committed Sep 3, 2023
1 parent 97426c9 commit 1f3117a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inc/functions/htaccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ function get_rocket_htaccess_mod_rewrite() { // phpcs:ignore WordPress.NamingCon
$rules = '';
$gzip_rules = '';
$enc = '';
$webp = '';

if ( $is_1and1_or_force ) {
$cache_dir_path = str_replace( '/kunden/', '/', WP_ROCKET_CACHE_PATH ) . $http_host . '%{REQUEST_URI}';
Expand Down Expand Up @@ -267,8 +268,12 @@ function get_rocket_htaccess_mod_rewrite() { // phpcs:ignore WordPress.NamingCon
$rules .= 'RewriteCond %{HTTP_USER_AGENT} !^(' . $ua . ').* [NC]' . PHP_EOL;
}

$rules .= 'RewriteCond "' . $cache_dir_path . '/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html' . $enc . '" -f' . PHP_EOL;
$rules .= 'RewriteRule .* "' . $cache_root . $http_host . '%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html' . $enc . '" [L]' . PHP_EOL;
if ( get_rocket_option( 'cache_webp' ) ) {
$webp = '%{ENV:WPR_WEBP}';
}

$rules .= 'RewriteCond "' . $cache_dir_path . '/index%{ENV:WPR_SSL}' . $webp . '.html' . $enc . '" -f' . PHP_EOL;
$rules .= 'RewriteRule .* "' . $cache_root . $http_host . '%{REQUEST_URI}/index%{ENV:WPR_SSL}' . $webp . '.html' . $enc . '" [L]' . PHP_EOL;
$rules .= '</IfModule>' . PHP_EOL;

/**
Expand Down

0 comments on commit 1f3117a

Please sign in to comment.