View previous topic :: View next topic |
Author |
Message |
jflintz n00b
Joined: 10 May 2005 Posts: 37
|
Posted: Mon Jul 18, 2005 6:15 am Post subject: mod_rewrite theory question |
|
|
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 |
|
|
Janne Pikkarainen Veteran
Joined: 29 Jul 2003 Posts: 1143 Location: Helsinki, Finland
|
Posted: Mon Jul 18, 2005 7:28 am Post subject: |
|
|
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 |
|
|
dev-urandom Apprentice
Joined: 24 Jun 2005 Posts: 260 Location: Huh?
|
Posted: Mon Jul 18, 2005 7:36 am Post subject: Re: mod_rewrite theory question |
|
|
[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 |
|
|
dev-urandom Apprentice
Joined: 24 Jun 2005 Posts: 260 Location: Huh?
|
Posted: Mon Jul 18, 2005 7:39 am Post subject: |
|
|
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 |
|
|
Janne Pikkarainen Veteran
Joined: 29 Jul 2003 Posts: 1143 Location: Helsinki, Finland
|
Posted: Mon Jul 18, 2005 7:46 am Post subject: |
|
|
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 |
|
|
jflintz n00b
Joined: 10 May 2005 Posts: 37
|
Posted: Mon Jul 18, 2005 5:19 pm Post subject: mod_rewrite theory question [SOLVED} |
|
|
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 |
|
|
|