Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何重新编写直接链接的图像链接以指向 php 文件?
从 http://...../picture.jpg 到 http://....../load.php?file=picture.jpg
可以使用 mod_rewrite 完成吗?
是的,它可以做到。就像是:
RewriteRule ^(.*)\.jpg$ /load.php?file=$1 [L]
是的,这条规则:
RewriteRule ^(.+\.jpg)$ /load.php?file=$1 [L]
如果要重定向所有图像,可以添加其他扩展:
RewriteRule ^(.+\.(jpe?g|png|gif|bmp))$ /load.php?file=$1 [L]