Title: htaccess redirect doesnt work. Need help with modifying code..
Last modified: April 17, 2019

---

# htaccess redirect doesnt work. Need help with modifying code..

 *  Resolved [omris83](https://wordpress.org/support/users/omris83/)
 * (@omris83)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/htaccess-redirect-doesnt-work-need-help-with-modifying-code/)
 * I’m with SiteGround (Apache servers) and cant get the webp htaccess mod redirect
   to work. Siteground have said:
 * Thank you for your patience.
 * The files are indeed loaded via .jpg extension but internally they are using 
   the .webp format which you set. You can verify this from the response headers
   of the request.
 * [https://screencast.com/t/SrjdTkFod](https://screencast.com/t/SrjdTkFod)
 * This is normal behavior as your mod_rewrite code in the .htaccess file does not
   include redirect (through the “R” flag) and the images remain with the same URL.
   If you would like to have the same redirected, you should consider updating your.
   htaccess code.
 * Does anyone know how to update the htaccess so it redirects through the R flag?

Viewing 1 replies (of 1 total)

 *  Plugin Author [ShortPixel](https://wordpress.org/support/users/shortpixel/)
 * (@shortpixel)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/htaccess-redirect-doesnt-work-need-help-with-modifying-code/#post-11442240)
 * Thanks for reaching out!
    The fact that the WebP image is served with the original
   extension (.jpg for example) is intended, because a redirect for each image would
   impact the performance of the page (doing another round trip to the web server
   for that image). Could you please tell me what would be the reason/use-case needing
   this redirect, in the first place? If you still need to do the 302 redirect, 
   you should use:
 * `RewriteRule (.+)\.(?:jpe?g|png)$ %1.webp [NC,T=image/webp,E=webp,R,L]`
 * This worked on my test environment. Please also note that you’re using an old
   version of the ShortPixel’s .htaccess code, you can take the newer version from
   the plugin in res/img. Then you should also remove the section marks `# BEGIN/
   END ShortPixelWebp` together with the option in Advanced settings, because otherwise
   the plugin will rewrite the .htaccess section if deactivated and reactivated.

Viewing 1 replies (of 1 total)

The topic ‘htaccess redirect doesnt work. Need help with modifying code..’ is closed
to new replies.

 * ![](https://ps.w.org/shortpixel-image-optimiser/assets/icon-256x256.gif?rev=3245715)
 * [ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF](https://wordpress.org/plugins/shortpixel-image-optimiser/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortpixel-image-optimiser/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortpixel-image-optimiser/)
 * [Active Topics](https://wordpress.org/support/plugin/shortpixel-image-optimiser/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortpixel-image-optimiser/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/)

## Tags

 * [htaccess](https://wordpress.org/support/topic-tag/htaccess/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)
 * [webp](https://wordpress.org/support/topic-tag/webp/)

 * 1 reply
 * 2 participants
 * Last reply from: [ShortPixel](https://wordpress.org/support/users/shortpixel/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/htaccess-redirect-doesnt-work-need-help-with-modifying-code/#post-11442240)
 * Status: resolved