{"id":858,"date":"2024-05-07T11:44:34","date_gmt":"2024-05-07T11:44:34","guid":{"rendered":"https:\/\/kb.shortpixel.com\/docs\/how-to-rename-my-webp-images-from-single-to-double-extension\/"},"modified":"2025-08-27T08:41:45","modified_gmt":"2025-08-27T08:41:45","password":"","slug":"how-to-rename-my-webp-images-from-single-to-double-extension","status":"publish","type":"docs","link":"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-rename-my-webp-images-from-single-to-double-extension\/","title":{"rendered":"How to rename my WebP images from single to double extension"},"content":{"rendered":"\n<p>If you generated the WebP images with a single extension (<code>image.webp<\/code>) and want to use a plugin (like <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\" target=\"_blank\" rel=\"noopener\">LiteSpeed Cache<\/a>) that requires WebP files with a double extension (<code>image.jpg.webp<\/code>), you can either rename the WebP files manually or let ShortPixel handle the task.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Manual renaming<\/h2>\n\n\n\n<p>To manually rename the files, <strong>you need access to a shell console with Bash<\/strong>. If you&#8217;re unsure, consult your hosting provider or a trusted developer.<\/p>\n\n\n\n<p>Simply run the following script to rename all images in a folder (provide the folder as a parameter):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/bash<br>cd $1<br>for file in *.webp<br>do<br>  if test -f \"${file%.webp}.jpg\"<br>  then<br>    echo \"${file%.webp}.jpg\" EXISTS. Moving \"$file\" to \"${file%.webp}.jpg.webp\"<br>    mv \"$file\" \"${file%.webp}.jpg.webp\"<br>  fi<br><br>  if test -f \"${file%.webp}.jpeg\"<br>  then<br>    echo \"${file%.webp}.jpeg\" EXISTS. Moving \"$file\" to \"${file%.webp}.jpeg.webp\"<br>    mv \"$file\" \"${file%.webp}.jpeg.webp\"<br>  fi<br><br>  if test -f \"${file%.webp}.png\"<br>  then<br>    echo \"${file%.webp}.png\" EXISTS. Moving \"$file\" to \"${file%.webp}.png.webp\"<br>    mv \"$file\" \"${file%.webp}.png.webp\"<br>  fi<br><br>  if test -f \"${file%.webp}.gif\"<br>  then<br>    echo \"${file%.webp}.gif\" EXISTS. Moving \"$file\" to \"${file%.webp}.gif.webp\"<br>    mv \"$file\" \"${file%.webp}.gif.webp\"<br>  fi<br>done<\/pre>\n\n\n\n<p>You will need to execute this in each folder or incorporate it into a shell script that traverses the directory structure. To achieve this, you can use a command like the following (assuming the script above is named <code>replace-in-folder.sh<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">find . -type d -exec .\/replace-in-folder.sh {} <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Automatic renaming<\/h2>\n\n\n\n<p>Automatic renaming is only possible if you first restore all the images. Please note that unless you have an <a href=\"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-does-the-unlimited-plan-work\/\">Unlimited plan<\/a>, this process will use additional credits. Follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/can-i-restore-my-images-what-happens-with-the-originals\/\" rel=\"noopener\">Restore your images.<\/a><\/li>\n\n\n\n<li>Add the following constant to your wp-config.php file: <code>define('SHORTPIXEL_USE_DOUBLE_WEBP_EXTENSION', true);<\/code><\/li>\n\n\n\n<li>Optimize your images again <a href=\"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-serve-webp-files-using-spio\/\">while creating WebP files<\/a>.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>If you generated the WebP images with a single extension (image.webp) and want to use a plugin (like LiteSpeed Cache) that requires WebP files with a double extension (image.jpg.webp), you can either rename the WebP files manually or let ShortPixel handle the task. Manual renaming To manually rename the files, you need access to a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[37],"glossaries":[],"doc_tag":[],"class_list":["post-858","docs","type-docs","status-publish","hentry","doc_category-shortpixel-image-optimizer"],"blocksy_meta":[],"year_month":"2026-04","word_count":306,"total_views":"1973","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin","author_nicename":"admin_mdli53m5","author_url":"https:\/\/kb.shortpixel.com\/author\/admin_mdli53m5\/"},"doc_category_info":[{"term_name":"ShortPixel Image Optimizer","term_url":"https:\/\/kb.shortpixel.com\/knowledge-base\/category\/shortpixel-image-optimizer\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/858","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/comments?post=858"}],"version-history":[{"count":1,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/858\/revisions"}],"predecessor-version":[{"id":1492,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/858\/revisions\/1492"}],"wp:attachment":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/media?parent=858"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_category?post=858"},{"taxonomy":"glossaries","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/glossaries?post=858"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_tag?post=858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}