get_upload_rel_path(); $webp_path = trailingslashit( $webp_dir->get_webp_path() ); $webp_rel_path = trailingslashit( $webp_dir->get_webp_rel_path() ); $base = trailingslashit( dirname( $upload_relpath ) ); $directory = trailingslashit( basename( $upload_relpath ) ); $regex_base = ltrim( $base, '/\\' ) . '(' . $directory . ')'; $regex_base = str_replace( '/', '\/', $regex_base ); /** * We often need to remove WebP file extension from Nginx cache rule in order to make Smush WebP work, * so always add expiry header rule for Nginx. * * @since 3.9.8 * @see https://incsub.atlassian.net/browse/SMUSH-1072 */ $code = <<