Title: Multisite html rewrite only works when debug is enabled
Last modified: August 21, 2016

---

# Multisite html rewrite only works when debug is enabled

 *  Resolved [hulsman1986](https://wordpress.org/support/users/hulsman1986/)
 * (@hulsman1986)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/)
 * Hello! I am have been fiddling with your plugin, it is awesome. However, when
   trying to use the wp retina 2x plugin within a multisite; trouble starts to appear.
   Hopefully there is someone who has encountered the following issue and has found
   a solution.
 * First of; client side isnt an option as it doesn’t allow my images to be responsive.
   So i tried the server side option, but without succes. Tried to update the retinaimages.
   php, added the rewrite rule, but no luck. So i finally chose the html rewrite.
 * **Html rewrite works! BUT only when debug mode is enabled. ** The same goes for
   the client side option. It works, but only in debug mode.
 * This is happening on local, on a staging server ánd on our live server. So i 
   don’t think its a Cloudflare thing. Does anyone recognize this issue?
 * [http://wordpress.org/extend/plugins/wp-retina-2x/](http://wordpress.org/extend/plugins/wp-retina-2x/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [hulsman1986](https://wordpress.org/support/users/hulsman1986/)
 * (@hulsman1986)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/#post-3877213)
 * I opted for the client side solution (for now) and moderated the retina.js in
   order to keep the images at 100% width and auto height.
 *     ```
       $('#main-games img').each(function(){
               new RetinaImage(this);
       });
       ```
   
 * Only issue that remains is that @2x is added to the image url when using this
   snippet, even though @2x is already added… So you get the correct images but 
   also a load of 404’s in the console 😀
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/#post-3877215)
 * > Html rewrite works! BUT only when debug mode is enabled
 * Are you using caching? Maybe a cache plugin?
 * > Cloudflare thing
 * I don’t know on your local, but with Cloudflare the server-side wouldn’t work.
   The HTML Rewrite would though, and the Client-side too.
 * > Only issue that remains is that @2x is added to the image url when using this
   > snippet, even though @2x is already added
 * Why is @2x already there?
    You can check if the filename contains @2x, and if
   it doesn’t, then you’ll call the line “new RetinaImage”, otherwise not. Simple
   🙂
 *  Thread Starter [hulsman1986](https://wordpress.org/support/users/hulsman1986/)
 * (@hulsman1986)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/#post-3877217)
 * Hi, thanks for replying! Still lovin’ you plugin and spreading the name towards
   my m8’s 🙂
 * I am sticking with the client side solution. The site is cached three times through
   memcache, varnish and cloudflare… I bet one of those might cause the rewrite 
   to go bad? 😛
 * Anyway, the issue with the double @2x was due to a lazy load script. it caused
   the retina.js plugin to be called again when loading new content 😀 i sawk.
 * My dirty solution was to add the following script when loading new content:
 *     ```
       //serve retina images. Works with the WP 2x retina plugin
       $('#main-games .article-header img').each(function(){
             var imageSource = $(this).attr('src');
             if (imageSource.indexOf("@2x") >= 0) {
                   //already is a retina image
             } else {
                   //its not a retina image
                    new RetinaImage(this);
             }
       });
       ```
   
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/#post-3877218)
 * > memcache, varnish and cloudflare
 * Memcache => No HTML Rewrite, Cloudflare => No Server-Side. Only Client-Side left
   ^^
 * > the issue with the double @2x was due to a lazy load script
 * Ah yes, that’s often the case, and that’s where the Server-Side works very well
   in fact.
 * > My dirty solution was to add the following script when loading new content
 * Your solution is not dirty: it’s the right one 🙂
 *  Thread Starter [hulsman1986](https://wordpress.org/support/users/hulsman1986/)
 * (@hulsman1986)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/#post-3877219)
 * [http://i.imgur.com/0kA4sbu.gif](http://i.imgur.com/0kA4sbu.gif)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Multisite html rewrite only works when debug is enabled’ is closed to
new replies.

 * ![](https://ps.w.org/wp-retina-2x/assets/icon-256x256.png?rev=2597316)
 * [Perfect Images: Regenerate Thumbnails, Image Sizes, WebP & AVIF](https://wordpress.org/plugins/wp-retina-2x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-retina-2x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-retina-2x/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-retina-2x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-retina-2x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-retina-2x/reviews/)

## Tags

 * [multisite](https://wordpress.org/support/topic-tag/multisite/)

 * 5 replies
 * 2 participants
 * Last reply from: [hulsman1986](https://wordpress.org/support/users/hulsman1986/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/multisite-html-rewrite-only-works-when-debug-is-enabled/#post-3877219)
 * Status: resolved