我想重定向所有名称结尾的图像("-554-380"):
子域名调用:http://static.domain.de
http://domain.de/../..-554-380
-- 重定向 --> http://static.domain.de/images/..-554-380
我的根 .htaccess 文件如下所示:
RewriteCond %{HTTP_COOKIE} HTTP_IS_HIDPI
RewriteCond %{DOCUMENT_ROOT}/$1-554x380.$2 -f
RewriteRule ^(static/images.+)-277x190.(jpe?g|png)$ $1-554x380.$2 [NC,L]
感谢您的帮助
奥格尼
有这样的规则:
RewriteCond %{HTTP_HOST} ^(www.)?domain.de$ [NC]
RewriteRule ^(.+?-554-380)$ http://static.domain.de/images/$1 [L,NE,R=301]
RewriteCond %{HTTP_COOKIE} HTTP_IS_HIDPI
RewriteCond %{DOCUMENT_ROOT}/$1-554x380.$2 -f
RewriteRule ^(static/images.+)-277x190.(jpe?g|png)$ $1-554x380.$2 [NC,L]
更新:根据评论:
RewriteCond %{HTTP_HOST} ^static.domain.de$ [NC]
RewriteRule ^(.+?)-277x190.(jpe?g|png)$ /$1-554x380.$2 [NC,L] [L,NC,NE]