rosell-dk / webp-express

Wordpress plugin for serving autogenerated WebP images instead of jpeg/png to browsers that supports WebP
GNU General Public License v3.0
221 stars 63 forks source link

Generated htaccess's "RewriteCond: bad flag delimiters" #563

Open Vincent-Noben opened 2 years ago

Vincent-Noben commented 2 years ago

Hi,

I updated a local work in progress website, all plugins and core up to date. When generating new htaccess files from your plugin page all images & theme css etc all breaks.

Apache log displays: RewriteCond: bad flag delimiters After deleting the 3 htaccess files generated by your plugin the website works again.

PHP 7.4.16

Vincent-Noben commented 2 years ago

If I check the wp-content/themes/.htaccess or the wp-content/uploads/.htaccess in a syntax checker for htaccess it gives an error on lines 58 and 59.

Which is this block:

# Avoid redirecting to webp files that are bigger than the original
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteCond %{REQUEST_FILENAME} (?i)(D:/Development/mywebsite.com/Website 2020/wp-content/themes/)(.*)(\.jpe?g|\.png)$
  RewriteCond D:/Development/mywebsite.com/Website 2020/wp-content/webp-express/webp-images-bigger-than-source/themes/%2%3.webp -f
  RewriteRule . - [L]

I assume there should be an url instead of a local path?

rosell-dk commented 2 years ago

Actually, it is on purpose that it is a local path. I'm guessing that the problem is due to the space in a folder name. Perhaps all that is needed is some quotes around the paths