If I’m reading it right, your regex has only two items in (), which means that only $1 and $2 have any meaning.
I copied your sample text and went to https://regex101.com/ (note: this is not an endorsement) to try to assemble a regex that’ll cover all your images. Here’s what I ended up with:
Pattern: ^(.*\/[0-9]{1,4}\/[0-9]{1,2}\/)([^\.]+)\.(jpg|jpeg|gif|png)\.webp
Replacement: $1$2.$3
This is using the PCRE standard, which is apparently used in PHP < 7.3. You may need to tweak the regex if you’re using PHP 7.3 or 7.4 (or higher), or if you want to use it in a .htaccess file.
Related Posts:
- rewrite rules and querystring
- add_rewrite_rule: $matches var not replaced by captured value
- Custom permalinks with NextGEN Gallery
- How to change default page slug?
- Will references to ugly links automatically redirect to their pretty url permalink?
- How do I add a add_rewrite_rule without it redirecting?
- WordPress URL rewrite regex
- WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)
- Sub domain redirection to taxonomy
- Redirecting all old links from previous EE site to new WP site in one go?
- Server (WordPress) redirects files that are not supposed to (using htaccess)
- Rewrite WordPress Custom URL
- WordPress removes spaces in URL on pagination
- Remove all categories from URL
- Custom rewrite rule
- Home page with Polylang redirects to other page [closed]
- expecting 404 but redirecting to post with url subdirectory in post title
- Rewrite of URL with ‘[‘ ‘]’ or ‘(‘ ‘)’ as literals
- Alias ‘wp-content’ directory to something shorter (framework?)
- Is there a ‘rake routes’ for wordpress?
- Remove Query String from URL on Redirect – Redirection Plugin
- How to properly rewrite url by custom var
- Rewrite rule to load images from production does nothing
- add_rewrite_rule fro html to another url not working
- Double domain name in category URL-s
- optimize wordpress rewrite rule regex
- WordPress redirects non-existing url to existing ones – how to disable
- Rewrite Preview URL to include index.php
- How to disable URL rewriting for specific URLs?
- Custom rewrite_rules – only pass numbers and not alphabetic characters
- Can I change default registration link (without htaccess)?
- How do I display only the parent page in the url
- How to remove wordpress directory slash
- Wildcard forward all posts and pages with few exceptions
- Redirect HTTP to HTTPS for all sub domains (blog posts)
- Rewrite query string to path
- How to redirect large amount of URLs?
- Redirecting /px/?q=x to /px/x/
- How do I only allow downloads that are referred from my domain?
- URL redirect on updating the post date
- How to redirect a link to a new link?
- Rewrite vs Redirect from ?p={ID}
- 301 Redirect all posts urls from .html to / (without .html)
- Is WordPress API visible from PHP file called in htaccess
- How can I reduce the number of rewrite rules?
- Re-directing URLs with dates to URLs without dates
- Redirect htaccess [closed]
- WP in subfolder hidden by htaccess, but media links show the subfolder
- 301 Rewriting htaccess
- 404 redirect based on url
- How are rewrite rules applied in WordPress?
- WordPress 3.1.2 Network Enabled non-www to www
- Redirect to new domain that serves new and different content
- add_rewrite_rule with optional parameters
- Redirect users with “.” (dot) in their username and replace with “-” (dash) to correct profile
- Rewrite rule regex help required
- Redirect empty search to another page
- Remove part from dynamic url and redirect
- Fresh install redirects to www, breaking page loads
- Broken page redirect
- Make URL like /fr/something display same as /something
- Remove trailing slash
- taxonomy term in URL slug won’t forward to the correct term for custom post like it does for default categories/normal posts
- Error 404 wordpress redirecting URL
- How to create short urls for sharing and downloadable content?
- Redirect A URL Pattern In WordPress Using .htaccess
- URLs ending with number higher than 2147483647 redirects to to domain.com/2147483647
- Migration from old CMS to WordPress 301 redirection rules?
- Changes done to .htaccess are not getting reverted back
- How to change search url produced by ‘s GET method?
- Need help with regex
- Using .htaccess to redirect /da/ to / in URL
- Standard Regex syntax doesn’t work in WordPress rewrite rule
- How to combine nearly identical custom rewrite rules for WordPress
- openlitespeed rewrite rules conversion from apache
- Allow requests to resources outside the wordpress folder
- web.config conflict on IIS
- Tricky URL rewrite with custom values in url
- Add rewrite rule for rewrite endpoint
- ‘rewrite_rules_array’ or ‘generate_rewrite_rules’ for adding custom rewrite rules?
- WordPress 3.9 breaks invalid permalinks.. code fix possible?
- Hide admin login without plugin
- Trying to find the location of a rewrite of the URL query
- “View post” leads to odd URL
- How can I redirect product url to category then product url?
- Map secondary domain to other’s virtual subfolder
- Flush rewrite rules on option update with Settings API
- Integer based rewrite isn’t recognized for value of 1
- ubuntu + nginx – everything works except “rewrite url structure” [closed]
- Rewriting in wordpress url
- Add pagination to a template loaded by query variable
- get variable from url?
- Home page url rewriting WordPress
- Changing the wordpress default search url to something like – …example.com/search?query=keyword
- WordPress is adding “category” word before my actual category name in url (and this is unsolicited)
- WordPress address url option missing under general setting
- Rewrite rule for post as a child of a CPT
- Post & Page with same slug
- 404 for index.php
- How to stop WordPress from replacing plus (+) characters from URL on the front page?