Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries, should producers of soft ware based services such as ATMs be held liable for economic injuries suffered when their systems fail?, nisc wwwxxx, wwwxxx0cm, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?, wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry

Links

XODOX
Impressum

#1: redirect on ip adress

Posted on 2005-09-08 10:29:35 by merlin

Hi there,

I would like to redirect all trafic which does not come from a specified IP to
another URL.

Something like this:
RewriteEngine On
RewriteRule ^(.*)$ http://www.newadress.net/

Any idea if this could be done with a regex instead of .* ?

Thanx for any help,

Merlin

Report this message

#2: Re: redirect on ip adress

Posted on 2005-09-08 14:02:29 by Richard Antony Burton

Merlin wrote:
> I would like to redirect all trafic which does not come from a specified
> IP to another URL.
>
> Something like this:
> RewriteEngine On
> RewriteRule ^(.*)$ http://www.newadress.net/

Try something like this:
RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
RewriteRule ^(.*)$ http://www.newadress.net/

This will rewrite all requests that aren't from the specified ip address.

Richard.

Report this message

#3: Re: redirect on ip adress

Posted on 2005-09-09 08:37:57 by merlin

Hi,

without the negation it works:
RewriteCond %{REMOTE_ADDR} ^141.62.11.80$

but with negation it does not
RewriteCond %{REMOTE_ADDR} !^141.62.11.80$

I tried to escape the dots but it also did not help. The IP seems to be correct.

Any ideas if the syntax could be different?

Thanx,

Merlin

Richard Antony Burton wrote:
> Merlin wrote:
>
>> I would like to redirect all trafic which does not come from a
>> specified IP to another URL.
>
> >
>
>> Something like this:
>> RewriteEngine On
>> RewriteRule ^(.*)$ http://www.newadress.net/
>
>
> Try something like this:
> RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
> RewriteRule ^(.*)$ http://www.newadress.net/
>
> This will rewrite all requests that aren't from the specified ip address.
>
> Richard.

Report this message

#4: Re: redirect on ip adress

Posted on 2005-09-09 09:57:59 by Richard Antony Burton

Merlin wrote:
> without the negation it works:
> RewriteCond %{REMOTE_ADDR} ^141.62.11.80$
>
> but with negation it does not
> RewriteCond %{REMOTE_ADDR} !^141.62.11.80$

What do you mean it works without the negation, and not with it? Do you
mean that without the negation it does what you want, but in reverse?
i.e. it redirects requests from that address, but not from everywhere
else? What does your rewrite log show? I did test this, and it does work.

> I tried to escape the dots but it also did not help. The IP seems to be
> correct.

Ah yes, good thinking, though that will only stop a few extra possible
matches, not prevent it matching the one it should.

Richard.

Report this message

#5: Re: redirect on ip adress

Posted on 2005-09-09 10:17:42 by patpro

In article <3ocpkpF5b80dU1@individual.net>,
Merlin <ngroups@fastmail.fm> wrote:

> Hi,
>
> without the negation it works:
> RewriteCond %{REMOTE_ADDR} ^141.62.11.80$
>
> but with negation it does not
> RewriteCond %{REMOTE_ADDR} !^141.62.11.80$

did you try :

RewriteCond %{REMOTE_ADDR} !=^141.62.11.80$

or

RewriteCond %{REMOTE_ADDR} !(141.62.11.80)

patpro

Report this message