Problem with rewrite engine and video files

zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Tue, 2002-10-01 19:31

Hello:

I setup the mod_rewrite to protect the albums folder and it works fine with all picture files: I can browse the gallery without problem, I can't download the image directly (which is what I wnat), etc.. But I had problem for the video files. When I click on the movie icon, WindowsMediaPlayer popup and can't play the file. I can't do 'right click - save target as' routine because the rewrite protection. Is there anyway to get around it?

Thanks.

 
zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Thu, 2002-10-03 22:52

Can anyone help me?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2002-10-04 18:12

What's the URL to your Gallery, and what rewrite rules did you use?

 
zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Fri, 2002-10-04 20:57

I am testing it on a local machine (FreeBSD). Here is the .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.homedomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://homedomain.com/ [NC]
RewriteRule /* - [F]
</IfModule>

It works for all the image files. But when I click on a video file, the Windows MediaPlayer popup and can't retreive the file. I suppose WMP just like the "Save As..." command that has no referral. And idea?

Thanks for your reply.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2002-10-04 22:24

I still need the URL to your Gallery.

Also, does everything work correctly if you remove the .htaccess rewrite protection?

 
zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Sat, 2002-10-05 00:02

If I removed the .htaccess, everything is fine. I can download the movie and the MediaPlayer plays it fine.

The site contains adult pictures, will it be fine to post the url here? thanks.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2002-10-06 23:38

Sure, it's fine with me.

 
zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Mon, 2002-10-07 01:41

<!-- BBCode Start --><A HREF="http://www.eroticwebshots.com/gallery/modules.php?set_albumName=album48&amp;op=modload&amp;name=Gallery&amp;file=index&amp;include=view_album.php" TARGET="_blank">Here</A><!-- BBCode End --> is the direct link to the album with one video file. Please use test/test to <!-- BBCode Start --><A HREF="http://www.eroticwebshots.com/gallery/modules.php?name=Your_Account" TARGET="_blank">login</A><!-- BBCode End --> the phpNuke first. Currently, the rewrite engine is on. You can view all the picture files fine. Only the video file has problem.

The site is not live now. So don't be surprised if you see broken thumbs on the front page. I am testing the mySQL mod by Richard Benfield. Obviously there is a bug about creating thumb info. I don't have time to check the source yet.

The gallery is embedded in phpNuke and it's pretty slow. Although the server isn't a fast one (PIII933, 512MB ram), but it's still slow to me (I have php accelerator installed). I don't if the server can hold after I pump 10,000 visitors to it. Maybe phpNuke isn't a good way to make large site? If you know any trick to improve the performance, please be sure to let me know. Thank you.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2002-10-07 02:25

Ok, I can see the problem happening. I sniffed the packet traffic and verified your hypothesis: WMP is not sending the "Referer" HTTP header.

Unfortunately, I don't have an easy solution for this. You could search the Customization forum to see if anybody has implemented a real image firewall, you could write one yourself, or you could change your .htaccess to ignore .wmv files (leaving a back door to your movies).

G2 does this the right way -- your data doesn't live in the webserver root. It's accessible only via a script which checks all permissions. But G2 is still pre-alpha and won't be ready to use in a production environment for at least 4 months.

 
zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Mon, 2002-10-07 06:26

I figure the G2 will be the best solution. For now, I may write another script to deliver the video files. Thanks for your help. I was just wondering if I did something wrong.