• Discussion
  • OpenLiteSpeed - redirect for non-existent files (mod_rewrite)

Hi!
I have a problem with mod_rewrite in OpenLiteSpeed. I have optimized several hundred images and moved them from the folder e.g. wp-content/uploads/2022/12/ to the folder wp-content/uploads/optimized/2022/12/, I am still optimizing some.
I tried to use the htaccess rule, which works fine in Apache, but it doesn't want to work here:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*)$ https://domainname.tld/wp-content/uploads/optimized/$1 [R=301,L]

I tested various configurations from message boards, even through the vhost config file from openlitespeed. It didn't bring any result.
Can anyone help me with this rule? Any ideas?

    Connect with us: 📨 Telegram 💬 Discord Email: support@aapanel.com