PDA

View Full Version : .htaccess help?



Sageth
10-10-2008, 10:02 PM
I run an arcade site that uses files from IPBArcade. I'm having some problems with one of my rewrite rules where it's causing my anti-hotlink file to be in a transparent overlay in front of the swf, but only on certain games. I'm wondering if someone who has a bit more experience in .htaccess can help me out. Here's the relevant part of my file:


# Use PHP5CGI as default
AddHandler fcgid-script .php
Options +FollowSymlinks

RewriteEngine on

## Allow Sites listed
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?sageth\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?myspace\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?livejournal\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?blogspot\.com/ [NC]

## send inappropriate hotlinkers to "hotlink.swf"
#RewriteRule .*\.(swf)$ hotlink.swf [NC,L]

My caveat is that I didn't create the original .htaccess, but expanding it and enabling certain functions has proven difficult.

Anyway, this works fine. The game at http://www.sageth.com/game/1462/YetiSports-8---Jungle-Swing.html works perfectly. If I uncomment my rewrite for hotlinkers, the game loads properly, but then transparently overlays the hotlink.swf file. Other games show the non-transparent version, and yet other games work fine.

Does the code here look OK? I've even gone so far as to use a packet sniffer and read through my log files, but I can't find any evidence that the Yeti .swf file is calling home.

Any thoughts?

wysiwyg
10-11-2008, 02:10 AM
See if this works

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^(http://(.+\.)?(sageth|myspace|livejournal|blogspot)\.com| $) [nc]
RewriteRule \.swf$ /hotlink.swf [nc,l]

Sageth
10-11-2008, 01:50 PM
At a glance, this seems to work perfectly. The game doesn't have this overlay, non-approved sites can't hotlink, and everything still works on my site.

My only question is what is the difference between what you put and what I had? I even tried putting [NC,OR] and that wouldn't work.

Just trying to understand it so I can learn it better. Regardless, thank you very much for your help!

lildona
10-15-2008, 08:08 AM
I have a thought - stop using IPBArcade and switch to gamesitescript. They even have an automatic Download Games (http://www.playedonline.com/download/) section and it's a much better piece of software.

Sageth
10-15-2008, 01:49 PM
Coincidentally, this is GameSiteScript and it's their .htaccess file that I was troubleshooting because it is either poorly written or is not compatible with the features installed on bluehost (or it flat out doesn't do what I want it to).

Also, I'm not interested in providing games for download.



Edit: Additionally, while I do believe that GSS is good, it still has it's share of problems and bugs. And a lot of them. It's also not as efficient as it could be, which I'm currently working on. Then I'll spend time to make a theme that doesn't rely on tables and also one that actually uses CSS!

wysiwyg
10-16-2008, 03:22 AM
My only question is what is the difference between what you put and what I had?
The main things I changed was adding a check for a blank referrer (^$) and changing the relative link of hotlink.swf to /hotlink.swf, and neither one of those should really have fixed what you were describing. If you tried the [or] flag then it was basically the same as what I wrote.