我的图像缩略图的文件名中带有后缀“ _e”,例如: http://example.com/wp-content/uploads/2018/10/testname-800x500_e.jpg
我正在尝试编写.htaccess规则,该规则将跳过此后缀来重写此类URL,这意味着上面的URL需要重定向到此:
http://example.com/wp-content/uploads/2018/10/testname-800x500.jpg
答案 0 :(得分:1)
创建一个新的/wp-content/uploads/.htaccess
并遵循以下规则:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*/wp-content/uploads/.*/.+)_e(\.jpe?g)$ [NC]
RewriteRule ^ %1%2 [L,NE,R=301]