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)
-   -   htaccess question (https://gfy.com/showthread.php?t=146969)

save11 06-25-2003 11:09 PM

htaccess question
 
htaccess question:

Is this the proper format for blocking hotlinking by domain?
sogclub being the domain that is hotlinking

xxx being my (i wish) hehe domain



RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

Also, can you insert ip in place of domain name with this format?
Thanks

ex:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

directfiesta 06-25-2003 11:15 PM

why not use the " deny" function in the httpd.conf file , since it is only for one specific domain.

save11 06-25-2003 11:35 PM

Actually i'm getting hotlinked by several but they only show up in the ref log by ip

fiveyes 06-26-2003 12:18 AM

Quote:

Originally posted by save11
htaccess question:

Is this the proper format for blocking hotlinking by domain?
sogclub being the domain that is hotlinking

xxx being my (i wish) hehe domain



RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

Also, can you insert ip in place of domain name with this format?
Thanks

ex:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

There's no difference between "(/)?.*" and simply ".*", they both accept the same strings. The problem is, neither of those two regexes reject anything, it's a useless bit in rewrite code that someone wrote early on and has been repeatedly copied. Numerical IP addreesses will have neither the "www." nor the ".com". So, I'd write this as:

<B>RewriteCond %{HTTP_REFERER} !^http://65.125.235.178[NC, OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com[NC]
RewriteRule \.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]</B>

fiveyes 06-26-2003 12:26 AM

Oh, and the target address in the rewriterule need not and really shouldn't contain "http://" and [R], unless you are redirecting to a different server. So, if you're just sending them to the top of your site, write that line as:
<B>RewriteRule \.(gif|jpg|jpeg|bmp)$ / [NC]</B>

save11 06-26-2003 12:57 AM

Quote:

Originally posted by fiveyes
Oh, and the target address in the rewriterule need not and really shouldn't contain "http://" and [R], unless you are redirecting to a different server. So, if you're just sending them to the top of your site, write that line as:
<B>RewriteRule \.(gif|jpg|jpeg|bmp)$ / [NC]</B>



Ok.. Thanks.. I'll try it out

Reak 06-26-2003 01:04 AM

Quote:

Originally posted by save11
htaccess question:

Is this the proper format for blocking hotlinking by domain?
sogclub being the domain that is hotlinking

xxx being my (i wish) hehe domain



RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

Also, can you insert ip in place of domain name with this format?
Thanks

ex:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

dont know but i know you need to change you sig..

fiveyes 06-26-2003 01:17 AM

Oops, glad you bumped this, I overlooked that you're going about this back-assedwards! Me bad!

THIS is what you want (No"<B>!</B>'s"):

<B>RewriteCond %{HTTP_REFERER} ^http://65.125.235.178[NC, OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?sogclub.com[NC]
RewriteRule \.(gif|jpg|jpeg|bmp)$ / [NC]</B>

Sorry I didn't catch that first time around....

fiveyes 06-26-2003 01:19 PM

(bumping to make sure <B>save11</B> notices that last change. Otherwise, the only people able to view his images will be the hotlinkers!)

lil2rich4u2 06-26-2003 01:19 PM

:(

BlackCrayon 06-26-2003 01:44 PM

i got a little htaccess question of my own.

what do i need to add to my htaccess file for a HTTP 301 moved page?

fiveyes 06-26-2003 02:00 PM

Quote:

Originally posted by BlackCrayon
i got a little htaccess question of my own.

what do i need to add to my htaccess file for a HTTP 301 moved page?

Use a "Redirect permanent" for that. As in

<B>Redirect permanent /old-missing-page-1.html http://www.your-url.com/new-replacement-page-1.html
Redirect permanent /old-missing-page-2.html http://www.your-url.com/new-replacement-page-2.html </B>

BlackCrayon 06-26-2003 02:48 PM

Quote:

Originally posted by fiveyes

Use a "Redirect permanent" for that. As in

<B>Redirect permanent /old-missing-page-1.html http://www.your-url.com/new-replacement-page-1.html
Redirect permanent /old-missing-page-2.html http://www.your-url.com/new-replacement-page-2.html </B>

much thanks man! :)

LBBV 06-26-2003 03:21 PM

Or, to prevent ANYONE from linking to your images...


RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN:80/.*$ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://SOMEURL


Be sure to replace YOURDOMAIN with your actual domain name, and replace SOMEURL with the URL that you want the surfer to go to should they actually click on the red X on the hot linkers site!

fiveyes 06-26-2003 04:16 PM

Quote:

Originally posted by LBBV
Or, to prevent ANYONE from linking to your images...


RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN:80/.*$ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://SOMEURL


Be sure to replace YOURDOMAIN with your actual domain name, and replace SOMEURL with the URL that you want the surfer to go to should they actually click on the red X on the hot linkers site!

Won't block "http://MYDOMAIN/YOURDOMAIN/hotlink-page.html" (you can use "." within a directory name on *nix).


All times are GMT -7. The time now is 11:24 PM.

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