ocastaneda82
3/23/2017 - 11:34 PM

retina.js bug 404

retina.js bug 404

#QH MOD BEGIN
#This block of code needs to go above your Wordpress rules
<IfModule rewrite_module>
#This is to short circuit non existent Retina image requests generated by retina.js
# without this, the whole wordpress 404 stack will be executed which is very expensive
# We simply redirect the request to the non @2x version of the file, if one exists, otherwise, send a 404 status
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} @2x\.[a-z]+$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)@2x(.*)$ $1$2 [E=QHNORETINA:1]
RewriteCond %{ENV:QHNORETINA} 1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* - [L,R=404]
</IfModule>
#QH MOD END