Reply
Re-direct by IP address
Old 07-10-2007, 11:03 AM Re-direct by IP address
Guerrilla's Avatar
Ultra Talker

Posts: 378
Hi Guy,

Is there any way that I can redirect certain IP's that hit my website?

I had thought this was possible with .htaccess file but none of the tutorials I have found have said how to do it.

Many thanks,

G
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 07-10-2007, 12:36 PM Re: Re-direct by IP address
chrishirst's Avatar
Super Moderator

Posts: 11,885
Location: Blackpool. UK
bit of a roundabout way would be to use deny from and then use a custom 403 error to bounce users off.

or a php include to get the user IP ["REMOTE_ADDR"], compare it to a DB table then redirect or not.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-10-2007, 04:24 PM Re: Re-direct by IP address
Guerrilla's Avatar
Ultra Talker

Posts: 378
Hey chris,

Thanks for the reply. I like the idea with the 403, it never occurred to me. I think though that the most practical way would be to use php, i have around 1000 pages in my website though all named .htm, quite a few other websites link the the .htm files so by making them all .php i would break some links and lose some traffic. I noticed some scripts out there like hit counters that call php with javascript. so the file extension can still finish .htm, I have never done this before, do you think it would work in this scenario?
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
Old 07-10-2007, 05:41 PM Re: Re-direct by IP address
chrishirst's Avatar
Super Moderator

Posts: 11,885
Location: Blackpool. UK
Quote:
quite a few other websites link the the .htm files so by making them all .php i would break some links and lose some traffic.
You could have .htm parsed as PHP by using

AddHandler application/x-httpd-php .php .html .htm

in your .htaccess file.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-10-2007, 05:42 PM Re: Re-direct by IP address
Guerrilla's Avatar
Ultra Talker

Posts: 378
Excellent. Chris, you have truly helped me out today. Thanks!
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Re-direct by IP address
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13463 seconds with 13 queries