是否有一个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图像的网页重定向?
发布评论