将链接重定向到包含点 (.)

Redirecting links to images that contains dot (.)

此代码仅适用于不包含点 (.) 的链接。例如:http://www.example.com/manufacturers/hyundai/hyundai-i40/hyundai-i40-4.jpg

RewriteCond %{HTTP_ACCEPT} text/html
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example\.com [NC]
RewriteRule ^manufacturers/([^/]+/[^/]+)/[^/.]+\.jpg$ / [L,NC,R=302]

但是,这不适用于包含点的链接。 http://www.example.com/manufacturers/hyundai/hyundai-i40-1.8/hyundai-i40-1.8-4.jpg

欢迎任何想法

您可以使用:

RewriteCond %{HTTP_ACCEPT} text/html
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example\.com [NC]
RewriteRule ^manufacturers/([^/]+/[^/]+)/.+?\.jpg$ / [L,NC,R=302]