Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



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

Posts: 424
Trades: -1
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
 
 
Register now for full access!
Old 07-10-2007, 01:36 PM Re: Re-direct by IP address
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-10-2007, 05:24 PM Re: Re-direct by IP address
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
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, 06:41 PM Re: Re-direct by IP address
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-10-2007, 06:42 PM Re: Re-direct by IP address
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.15051 seconds with 12 queries