Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-18-2003, 08:01 AM
|
#1
|
Member
Registered: Dec 2002
Posts: 56
Rep:
|
how to protect images linking from other website
my site is running VBulletin, I want to protect web images linking from other web sites.
I use mod_rewrite to block all .gif , .jpg and it works.
However in VBB some images are stored in database and those images are generated on the fly, so how do I protect such kind of images ?
e.g. users self upload avatars are stored in database but store in a file on the disk.
i.e.
http://mydomain/avatar.php?userid=22...ine=1042163461
actually that url is an image generated on the fly
|
|
|
10-18-2003, 08:12 AM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Just deny access to avatar.php as well as *.gif or *.jpg unless it is from a local referer.
|
|
|
10-18-2003, 08:49 AM
|
#3
|
Member
Registered: Dec 2002
Posts: 56
Original Poster
Rep:
|
how to write this mod_rewrite rule ?
|
|
|
10-18-2003, 08:53 AM
|
#4
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
If you look at your existing rules there will be a line that stops your images from getting pulled you can add a new rule the same for avatar.php rather than your jpgs or gifs. If you are unsure then post your current rules.
|
|
|
10-18-2003, 09:19 AM
|
#5
|
Member
Registered: Dec 2002
Posts: 56
Original Poster
Rep:
|
here is my existing rules in my .htaccess
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^ http://www.mydomain.com/.*$ [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG)$ - [F]
what rule should I add to prevent images generated from avatar.php page ?
|
|
|
10-18-2003, 09:35 AM
|
#6
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
You need a rewrite rule like:
RewriteRule .*avatar\.php.* - [F]
|
|
|
10-18-2003, 10:53 AM
|
#7
|
Member
Registered: Dec 2002
Posts: 56
Original Poster
Rep:
|
Quote:
Originally posted by david_ross
You need a rewrite rule like:
RewriteRule .*avatar\.php.* - [F]
|
I added followings in httpd.conf
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ http://bbs.dmhy.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^ http://www.dmhy.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^ http://61.152.96.66/.*$ [NC]
RewriteRule .*avatar\.php.* - [F]
but images generated from that php page still can be linked by other web site
|
|
|
10-18-2003, 11:27 AM
|
#8
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Well I have created a test environment on my server and it seems to work fine however I can still grab the avatars from your site. Then again I can also get:
http://bbs.dmhy.net/images/newblue/vb_bullet.gif
So maybe you don't have mod_rewrite working at all.
Is it enabled in httpd.conf?
|
|
|
10-19-2003, 07:43 AM
|
#10
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
I can get your logo and the go button - that is all I tried.
|
|
|
All times are GMT -5. The time now is 06:22 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|