GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Does anyone know the htaccess code that... (https://gfy.com/showthread.php?t=504951)

RedShoe 08-17-2005 05:33 PM

Does anyone know the htaccess code that...
 
I need the htaccess code (if there is one) that doesn't allow .jpg or .gif images to be displayed on their own.
I only want them to be displayed on an html page.

mrkris 08-17-2005 05:42 PM

Make sure you have mod rewrite.

Rewriteengine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ "NC"
RewriteRule .*\.(gif|GIF|jpg|JPG)$ - "F"

RedShoe 08-17-2005 05:47 PM

But isn't that just for anti hotlinking? I used that code and I still can see the image. What I want is the code that does not show the image unless it's on an HTML page.

If that's even possible.

mrkris 08-17-2005 05:51 PM

an HTML page is just a bunch of scripting that tells the browser what to display. When your browser sees an image, it grabs the image. In order to do what you want, from what I know, is to have a script READ the image from a non-web accessible directory and spit the contents to the browser.

RedShoe 08-17-2005 05:54 PM

AAhhhh.. that makes sense. Cool man, thanks.
A non-web accessible browser,... I didn't even think of doing it that way. Thanks. :)



edit...
Ok, so how do I call into a non-web accessible directory?

mrkris 08-17-2005 05:58 PM

depends on languages, etc. I do lots of php so I use fopen() or something similiar and pass it the path to the image i want to read. I also do this to create images with custom text based on an image template. perhaps someone else out there knows a better method.

Superterrorizer 08-17-2005 06:06 PM

Quote:

Originally Posted by mrkris
Make sure you have mod rewrite.

Rewriteengine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ "NC"
RewriteRule .*\.(gif|GIF|jpg|JPG)$ - "F"


Or just use that without the
RewriteCond %{HTTP_REFERER} !^$

which allows direct linking. The quotes around NC and F should be square braces though.

No need to dick around with anything else or any kind of scripting.

jimmyf 08-17-2005 06:09 PM

Quote:

Originally Posted by RedShoe
But isn't that just for anti hotlinking? I used that code and I still can see the image. What I want is the code that does not show the image unless it's on an HTML page.

If that's even possible.

the code I've got does what you want, all of my pics are in htm's... so is they type in (example) free1.jpg they go to 404

mikeyddddd 08-17-2005 06:32 PM

Quote:

Originally Posted by RedShoe
I used that code and I still can see the image.

Clear cache and then try typing in the pic's URL with the code supplied in place.

jimmyf 08-17-2005 06:40 PM

AuthUserFile /dev/null
AuthGroupFile /dev/null
AddHandler server-parsed .html
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX:80/.*$ [NC]
RewriteRule .*\.jpg$ http://www.YOUR-URL.com [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX:80/.*$ [NC]
RewriteRule .*\.gif$ http://www.YOUR-URL.com [R,L]
ErrorDocument 400 http://www.YOUR-URL.com/404/404.htm
ErrorDocument 401 http://www.YOUR-URL.com/404/404.htm
ErrorDocument 403 http://www.YOUR-URL.com/404/404.htm
ErrorDocument 404 http://www.YOUR-URL.com/404/404.htm
ErrorDocument 500 http://www.YOUR-URL.com/404/404.htm


REPLACE XXX.XXX.XXX.XXX 's WITH YOUR ip
hit enter 1 or 2 times after the last line

IMPORTANT transer it in ASCII

Doc911 08-17-2005 06:43 PM

yep you didn't clear your cache .


All times are GMT -7. The time now is 08:33 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123