的.htaccess图像的网页重定向?

编程入门 行业动态 更新时间:2024-10-09 02:26:03
本文介绍了的.htaccess图像的网页重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有一个htaccess的剧本我可以使用图像的URL重定向到一个实际的网页?

Is there a .htaccess script I can use to redirect the url of an image to an actual web page?

我能做些什么,以使它所以通过其地址栏键入的时候有人访问图像:的 www.sitename/uploads/192-file-name-here.jpg 或者其他的扩展类似 www.sitename/uploads/235-file-name -here.png

What can I do to make it so when someone accesses an image via their address bar by typing in: www.sitename/uploads/192-file-name-here.jpg or other extensions like www.sitename/uploads/235-file-name-here.png

有将代替用户重定向到网页: www.sitename/view/192-file-name-这里/

It will instead redirect the user to the web page: www.sitename/view/192-file-name-here/

欲仍然能够把整个网站并在外部网站虽然在图像标记的图像。

I want to still be able to place the images in image tags across the site and on external sites though.

RewriteCond %{HTTP_REFERER} !^https?:\\www\.sitename\ RewriteCond %{REQUEST_URI} (.*)\.jpg$ RewriteRule images/(\d+)\.jpg www.sitename/view/$1.html [L,R=301] RewriteCond %{HTTP_REFERER} ^$

可以这样修改/重写来执行我的功能?

Can this be modified/re-written to perform my function?

推荐答案

把这个在你的的.htaccess ,它会重定向可以被用户直接发送的所有请求。 注意:其他网站,正如你所提到可以把你的照片在他们的页面

put this in your .htaccess, it will redirect all requests that are sent directly by user.Note: Other sites,as you mentioned can put your images in their pages.

RewriteCond %{REQUEST_URI} ^/uploads/(\d+)-(.+)\.(png|gif|jpe?g|bmp)$ [NC] RewriteCond %{HTTP_REFERER} ^$ RewriteRule (.*) www.sitename/view/%1-%2/

更多推荐

的.htaccess图像的网页重定向?

本文发布于:2023-11-02 07:09:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551706.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   图像   网页   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!