PDA

View Full Version : htaccess heroes, anyone?


magnatique
07-28-2001, 11:23 AM
guys, I have some kind of problem on my server..

I need my pages to be built with a symlink...

the symlink is in my html folder, and is named "img" and leads to say "/home/www/fng/img1" for example

now, everything works fine... BUT, if I put a HTACCESS in order to block hotlinking in that directory, it sort of sees the access to the pics not from the allowed domains or something..

here's a copy of my htaccess, anyone got an idea?

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.freenudegalleries.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://freenudegalleries.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://free.freenudegalleries.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://free.loneisland.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.loneisland.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://flex.loneisland.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://loneisland.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.clicks4galleries.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://clicks4galleries.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.sexisfundude.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://sexisfundude.com/.*$ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$|.*[Mm][Pp][Gg]$|.*[Mm][Oo][Vv]$|.*[Aa][Ss][Ff]$|.*[Mm][Pp][Ee][Gg]$|*.[Ww][Mm][Vv]$ http://www.freenudegalleries.com/

jayeff
07-28-2001, 11:58 AM
I can't see anything specifically wrong with your code. But this is at least more simple and saves you having to worry about including lines for all the variations you may have on your domain names:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http(s)?://([^@\/]+@)?([a-z0-9-]+\.)*freenudegalleries.com(:80)?/ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://([^@\/]+@)?([a-z0-9-]+\.)*loneisland.com(:80)?/ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://([^@\/]+@)?([a-z0-9-]+\.)*clicks4galleries.com(:80)?/ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://([^@\/]+@)?([a-z0-9-]+\.)*sexisfundude.com(:80)?/ [NC]
RewriteRule /* http://www.freenudegalleries.com/ [L]

I have a setup like yours and that's based on the htaccess that works for me.

Ludedude
07-28-2001, 01:12 PM
Hey mag...that all looks OK to me, so don't know where the problem might be.

magnatique
07-29-2001, 07:16 PM
man, I really don't know what's wrong., still didn't find an fix... ANYONE ELSE?
btw, I tried yours jayeff, still same thing

moses
07-30-2001, 01:47 AM
Mag:

Have you checked the error log for the domain? It might have a clue.

Also, I'd try setting the redirect to an image, like:

RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$|.*[Mm][Pp][Gg]$|.*[Mm][Oo][Vv]$|.*[Aa][Ss][Ff]$|.*[Mm][Pp][Ee][Gg]$|*.[Ww][Mm][Vv]$ http://www.freenudegalleries.com/some_small_image_you_have.gif

and see if you get that image everywhere. That way you'll know for sure it's the hotlink protection kicking in, and not a 500 or 404/401 or something. If there was a typo somewhere in the htaccess (even one with unprintable characters you can't see when editing the file under windows), it would cause a 500 error, which would be a broken image on the pages with those img src's.

The one other thing I can think of (I have *no* idea why this would happen, but..) is that for some reason, the .htaccess is overriding the apache option FollowSymLinks. You could test to see if this is the case by putting

Options +FollowSymLinks

at the top of the .htaccess with the hotlink protection.

I could probably figure it out pretty quickly if you want to give me access to the machine.

Moses

Crunch
07-30-2001, 04:23 AM
I don't know if this is the problem but you could add the IPs of your domains to the htaccess file.

*Kimmykim*
07-30-2001, 01:25 PM
if you didn't get this worked out mag, let me know, I'll have one of the Cavecreek techs take a look at it for you -- http://bbs.adultwebmasterinfo.com/ubb/smile.gif

magnatique
07-31-2001, 12:16 AM
my tech was not too shabby about having me with the root access, now having somebody else know it hehe... and he used that on another computer, so I can't let anyone have access :\..


here's what's in my httpd.conf

I did the tests you said moses, and it doesn't load anything

actually, it's like it's working and not working..

see, if I type
http://www.freenudegalleries.com/july/img/sydnetdrs078.jpg

or
http://www.freenudegalleries.com/img2/sydnetdrs078.jpg

(that's the symlink one and direct one) it redirects using the htaccess info in freenudegalleries.com, not the htaccess in /img2...

it's weird, cuz the htaccess in img2 is what causes it to not allow the sydnetdrs078.jpg to load, but the htaccess on freenudegalleries.com/ is what tells it where to redirect...


here's what I have in the httpd.conf:


<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

<Directory /home/www/> #< this is the http root directory.
Options -Indexes FollowSymlinks
AllowOverride All
</Directory>