![]() |
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 |
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 |
Quote:
|
Yes probably the surfer too....
But why you don't block each IP Instead of a large IPS? Rocco |
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. |
Quote:
but thanks anyways :) |
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. :)
|
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... |
Thanks guys
|
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