The .htaccess URL rewrite is not functioning properly for images
Posted: Mon Jul 24, 2023 9:01 pm
Url rewrite is working, only image urls are not rewritten.
You would think if it works for urls it would work for images aswell
API and other rewritten urls are working, images are not, error log gives these errors:
Site was working before , just did a reinstall on a new server and bumped 1 debian version
You would think if it works for urls it would work for images aswell
Code: Select all
# ~~start~~ Do not remove this comment, thirty bees will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automatically generated by thirty bees e-commerce open-source solution
# http://www.thirtybees.com - http://www.thirtybees.com/forums
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine on
# Domain: www.mywebsite.be
RewriteRule . - [E=REWRITEBASE:/]
# Webservice API
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
# Images
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3$4.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4$5.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5$6.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6$7.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7$8.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8$9.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9$10.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10$11.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9\s-]*)?(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10$11.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9\s-]*)(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9\s-]*)(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/c/$1$2$3$4.webp [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^c/([a-zA-Z\s_-]+)(-[0-9]+)?/.+?([2-4]x)?\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^c/([a-zA-Z\s_-]+)(-[0-9]+)?/.+?([2-4]x)?\.webp$ %{ENV:REWRITEBASE}img/c/$1$2$3.webp [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^www.mywebsite.be$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/woff .woff
AddType font/woff2 .woff2
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404
# ~~end~~ Do not remove this comment, thirty bees will keep automatically the code outside this comment when .htaccess will be generated again
Code: Select all
023/07/24 20:47:12 [error] 621591#621591: *1 openat() "/home/sennevb/web/mywebsite.be/public_html/877-community-theme-default_large_default/home-control-videofoon-1-drukknop-pakket-22x.jpg" failed (2: No such file or directory), client: 87.67.112.179, server: mywebsite.be, request: "GET /877-community-theme-default_large_default/home-control-videofoon-1-drukknop-pakket-22x.jpg HTTP/2.0", host: "www.mywebsite.be", referrer: "https://www.mywebsite.be/nl/niko-home-control/niko-home-control-voor-busbekabeling/overige-componenten/videofonie/home-control-videofoon-1-drukknop-pakket-2"
2023/07/24 20:47:12 [error] 621591#621591: *1 openat() "/home/sennevb/web/mywebsite.be/public_html/877-community-theme-default_cart_default/home-control-videofoon-1-drukknop-pakket-22x.jpg" failed (2: No such file or directory), client: 87.67.112.179, server: mywebsite.be, request: "GET /877-community-theme-default_cart_default/home-control-videofoon-1-drukknop-pakket-22x.jpg HTTP/2.0", host: "www.mywebsite.be", referrer: "https://www.mywebsite.be/nl/niko-home-control/niko-home-control-voor-busbekabeling/overige-componenten/videofonie/home-control-videofoon-1-drukknop-pakket-2"
2023/07/24 20:47:27 [error] 621591#621591: *1 openat() "/home/sennevb/web/mywebsite.be/public_html/877-community-theme-default_large_default/home-control-videofoon-1-drukknop-pakket-22x.jpg" failed (2: No such file or directory), client: 87.67.112.179, server: mywebsite.be, request: "GET /877-community-theme-default_large_default/home-control-videofoon-1-drukknop-pakket-22x.jpg HTTP/2.0", host: "www.mywebsite.be"