拒绝访问url中具有特定名称的所有jpg url



我有这样的jpg URL:

http://domain.com/members/content/upload/temp/1600watermarked/photo.jpg
http://domain.com/members/content/upload/test-123/1200watermarked/photo.jpg
http://domain.com/members/content/upload/random/1800watermarked/photo.jpg

在文件夹内容中,我有一个htaccess文件,里面有这个:

<FilesMatch /watermarked/.*>
  Order Allow,Deny
  Deny from all
</FilesMatch>

但这似乎无法阻止任何带有"水印"字样的jpg URL。有什么建议吗?

经过更多的实验,我得到了这个:

RewriteCond %{REQUEST_URI} ^(.*)watermarked(.*)$
RewriteRule ^(.*)$ http://domain.com/forbidden.htm [R=301,L]

这并不是一个被禁止的错误,但在我的情况下效果更好,因为我可以将他们重定向到一个页面,升级他们的帐户以查看被阻止的内容。

最新更新