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 expert needed... (https://gfy.com/showthread.php?t=63881)

BabeHunter 06-11-2002 07:47 AM

htaccess expert needed...
 
I need an htaccess file that redirects visitors based on ip blocks...
for example i have all the ip blocks for japan...and i want to redirect them all to an ad page...
can you do it?
contact me at [email protected]
let me know...if it do what i need i'm willing to pay...hehe

zubr 06-11-2002 07:56 AM

Add the following to the .htaccess file:

< Limit GET >
order allow,deny
deny from .jp
allow from all
< /Limit >

ErrorDocument 403 http://japanese-popup-hell.com

--------------------------------------
Remove unnecessary spaces, otherwise part of the code wouldnt show up

BabeHunter 06-11-2002 07:58 AM

Quote:

Originally posted by zubr
Add the following to the .htaccess file:

<Limit GET>
order allow,deny
deny from .jp
allow from all
</Limit>

ErrorDocument 403 http://japanese-popup-hell.com

thanks man...but does it mean that only the ppl the come from domain.jp will be redirected? what about a japanese surfer that comes from domain.com?

Rocco 06-11-2002 08:37 AM

Yes probably the surfer too....

But why you don't block each IP Instead of a large IPS?

Rocco

salsbury 06-11-2002 09:28 AM

here's what i've got. it's a freebie, 'cause salsbury's a nice guy. (and 'cause i don't know if it'll work perfectly as-is. ;))

just a word of advice: using deny or allow with any type of hostname will force hostnamelookups on, which will slow down your surfer's experience. ie it's not so good.

create a file called "punklist.txt" in your site's root directory. add IP blocks and URLs to the file as so:

192.168.0 http://www.someblindlinksponsor.com/
127.0.0 http://www.whitehouse.gov/

etc. basically it expects to have the first 3 octets there. next, add the following to your httpd.conf file in your VirtualHost directive:

RewriteMap punk-o txt:/path/to/server/root/punklist.txt
RewriteCond %{REMOTE_ADDR} ^([0-9]*\.[0-9]*\.[0-9]*)\.[0-9]*
RewriteCond ${punk-o:%1|OK-TO-PASS} !=OK-TO-PASS
RewriteRule ^/.* ${punk-o:%1} [R,L]

unfortunately it won't work in the .htaccess file for whatever reason, silly apache.

if you'd like an explanation of all this, hit me for e-mail [email protected] . holy crap that took a lot longer to figure out than i expected. :) but it does indeed work.

BabeHunter 06-11-2002 09:34 AM

Quote:

Originally posted by salsbury
here's what i've got. it's a freebie, 'cause salsbury's a nice guy. (and 'cause i don't know if it'll work perfectly as-is. ;))

just a word of advice: using deny or allow with any type of hostname will force hostnamelookups on, which will slow down your surfer's experience. ie it's not so good.

create a file called "punklist.txt" in your site's root directory. add IP blocks and URLs to the file as so:

192.168.0 http://www.someblindlinksponsor.com/
127.0.0 http://www.whitehouse.gov/

etc. basically it expects to have the first 3 octets there. next, add the following to your httpd.conf file in your VirtualHost directive:

RewriteMap punk-o txt:/path/to/server/root/punklist.txt
RewriteCond %{REMOTE_ADDR} ^([0-9]*\.[0-9]*\.[0-9]*)\.[0-9]*
RewriteCond ${punk-o:%1|OK-TO-PASS} !=OK-TO-PASS
RewriteRule ^/.* ${punk-o:%1} [R,L]

unfortunately it won't work in the .htaccess file for whatever reason, silly apache.

if you'd like an explanation of all this, hit me for e-mail [email protected] . holy crap that took a lot longer to figure out than i expected. :) but it does indeed work.

Thanks man...but...the ip list that i have...is REALLY long...it will take days to write it...hehe
but thanks anyways :)

salsbury 06-11-2002 09:36 AM

np. however it probably wouldn't be too hard to set up the list with a good text editor like vi. in any case good luck. :)

fiveyes 06-11-2002 09:45 AM

Mmm, challenging, that. I love it!

Let's see,

order deny,allow

# Deny from a specific IP number
deny from 123.45.67.89

# Deny from 123.45.6.0 - 123.45.6.255
deny from 123.45.6

# Deny from 123.45.6.34 - 123.45.6.46
deny from 123.45.6.32/28

...

The last one, using netmasks, is the brain cruncher!

See http://httpd.apache.org/docs/mod/mod_access.html#allow
http://www.darklab.net/resources/netmask.html
http://metronet.min.net/Netmasks
http://handsonhowto.com/lan101.html
for what's needed...

BabeHunter 06-11-2002 10:40 AM

Thanks guys

vegasdude 06-11-2002 05:12 PM

I hate htaccess!!!


All times are GMT -7. The time now is 08:48 PM.

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