Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mod_rewrite theory question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jflintz
n00b
n00b


Joined: 10 May 2005
Posts: 37

PostPosted: Mon Jul 18, 2005 6:15 am    Post subject: mod_rewrite theory question Reply with quote

Calling all mod_rewrite gurus...... Calling all mod_rewrite gurus.....

I am looking to do something like this.

Let say an IP of 123.234.123.234 goes to my site. I want all traffic from that IP to be redirected to another URL. Who would that be done with mod_rewrite?

I have tried this

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^123.234.123.234
RewriteRule /* http://fbi.gov [R,L]

but to no avail it doesnt work.

I remember being able to do something like that but for the life of me can not remeber exactly. I have seen stuff for blog spammers and denying them but I want to redirect to another URL.

Kinda like if I told my to go to my site and the mod_rewrite would redirect him to a corperate site due to a rule with his static IP in the mod_rewrite.

Did I repeat myself or am I getting lost myself since it is now after 2:00 am EST and it is past my bed time and everything is starting to merge together on me.


enough of the bable from me now. Can it be done with mod_rewrite or am I crazy thinking that way?

Things that make you go hmmmmm!
_________________
No complaints will be allowed. All complaints will be symlinked to /dev/null

All others will be rerouted through iptables
Back to top
View user's profile Send private message
Janne Pikkarainen
Veteran
Veteran


Joined: 29 Jul 2003
Posts: 1143
Location: Helsinki, Finland

PostPosted: Mon Jul 18, 2005 7:28 am    Post subject: Reply with quote

Try this:

Code:
RewriteEngine On
RewriteCond %{REMOTE_ADDR}     ^123\.234\.123\.234$
RewriteRule ^(.*)              http://fbi.gov    [R,L]


Please note that it's not good practise to forward your traffic to FBI site or similar. Most of the bad traffic is generated by viruses and spiders, anyway.
_________________
Yes, I'm the man. Now it's your turn to decide if I meant "Yes, I'm the male." or "Yes, I am the Unix Manual Page.".
Back to top
View user's profile Send private message
dev-urandom
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 260
Location: Huh?

PostPosted: Mon Jul 18, 2005 7:36 am    Post subject: Re: mod_rewrite theory question Reply with quote

[quote="jRewriteEngine On
RewriteCond %{HTTP_REFERER} ^123.234.123.234
RewriteRule /* http://fbi.gov [R,L]
[/quote]

You need REMOTE_ADDR or REMOTE_HOST depending on your requirements.

If the user clicks on some page on http://some-server, then HTTP_REFERER is some-server.
_________________
/earth: file system full.
Back to top
View user's profile Send private message
dev-urandom
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 260
Location: Huh?

PostPosted: Mon Jul 18, 2005 7:39 am    Post subject: Reply with quote

err, iam sleepy too...

Forgot the check the whole syntax. Janne Pikkarainen, nice that you spotted that . had to be escaped.

BTW, to express what i said earlier more clearly, HTTP_REFERER is the server that lead the user to your site.
_________________
/earth: file system full.
Back to top
View user's profile Send private message
Janne Pikkarainen
Veteran
Veteran


Joined: 29 Jul 2003
Posts: 1143
Location: Helsinki, Finland

PostPosted: Mon Jul 18, 2005 7:46 am    Post subject: Reply with quote

dev-urandom wrote:

BTW, to express what i said earlier more clearly, HTTP_REFERER is the server that lead the user to your site.


To be more precise, HTTP_REFERER is the complete URL that leader the user to your site. Not just the server.
_________________
Yes, I'm the man. Now it's your turn to decide if I meant "Yes, I'm the male." or "Yes, I am the Unix Manual Page.".
Back to top
View user's profile Send private message
jflintz
n00b
n00b


Joined: 10 May 2005
Posts: 37

PostPosted: Mon Jul 18, 2005 5:19 pm    Post subject: mod_rewrite theory question [SOLVED} Reply with quote

perfect... Itried that once before with REMOTE_ADDR but most have had a foobar typo or something.


Thanks guys
_________________
No complaints will be allowed. All complaints will be symlinked to /dev/null

All others will be rerouted through iptables
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum