对于严重的服务器崩溃问题,我试图匹配@ 2x视网膜风格图像的任何请求,并将其重写为与non @ 2x等效。
首先我想检查一下是这样一个请求:
# NOTES: Check the file name to see if it matches the @2x pattern: RewriteCond %{REQUEST_FILENAME} ^(.*)(@2x\.\w+)$ [NC]
例如:
media/catalog/product/cache/1/thumbnail/100x/9df78eadfvrtdfgdfg6e5fb8d27136e95/i/n/[email protected]
然后我需要拿出@ 2x并返回:
媒体/目录/产品/高速caching/ 1 /缩略图/ 100X / 9df78eadfvrtdfgdfg6e5fb8d27136e95 / I / N / insample-123_1.jpg
可能是PNG或JPEG或PNG或GIF等
我不是RegExp忍者。 我知道如何更换部件,但不能删除。 任何人都可以请协助? 我的服务器正在死于404的…
编辑:似乎是这样的:
RewriteCond %{REQUEST_FILENAME} ^(.*)(@2x\.\w+)$ [NC] RewriteRule (.+)@2x\.(\w+)$ $1.$2 [R=302]