Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Apache Proxy

Name: Anonymous 2007-07-20 2:40 ID:fwl/Q2LL

I've been trying to set up my mod_proxy to redirect all requests from a certain ip address to one page with mod_rewrite, but have been having some trouble.  Any help here?

Name: Anonymous 2007-07-20 2:53 ID:X96B2X9H


RewriteEngine on
RewriteCond %{REMOTE_ADDR} 219.104.184.91
RewriteRule .*$ banned.html  [PT,L]

Name: Anonymous 2007-07-20 4:18 ID:X3ZW8TYJ

RewriteRule .* www.opera.com

Name: Anonymous 2007-07-20 8:11 ID:0lXc9FUo

>>2
That looks familiar. Did you get it from Trevorshitchan?

Anyway,
RewriteCond %{REMOTE_ADDR} ^219\.104\.184\.91$
RewriteRule .* banned.html [PT,L]


Also, I recommend sending a 403 Forbidden status as well, if it's actually a banned page that is.

Name: Anonymous 2007-07-20 13:14 ID:o8DsrFEL

>>4
No. If anything, Shitchan got it off me.

And it works just fine as is. Keep the readability, man! :)

Name: Anonymous 2007-07-20 14:44 ID:Heaven

>And it works just fine as is. Keep the readability, man! :)

please learn regexps

Name: Anonymous 2007-07-20 15:09 ID:j7ko/MkL

>>6

Actually, it works fine because REMOTE_ADDR is always an IP address.


   219.104.184.91
  ^   ^   ^   ^  ^
  |   |___|___|  |
put       |     and
anything  |     here
here      |
and      same
it'll    here
be an
invalid
IP address

Name: Anonymous 2007-07-20 15:28 ID:fwl/Q2LL

Thanks, but it doesn't seem to be working.  When I test it, it doesn't redirect.

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^127\.0\.0\.1$
RewriteRule .* http://www.google.com/ [PT,L]

Name: Anonymous 2007-07-20 15:29 ID:o8DsrFEL

please learn regexps
When I say it works just fine as it, I mean it as "this is a copy-pasta from a host on which it emprically works right now".

Is this your way of saying I'VE READ MAN PERLRE?


Name: Anonymous 2007-07-20 15:39 ID:VBOOTjWr

>>8

LoadModule rewrite_module modules/mod_rewrite.so

Name: Anonymous 2007-07-20 15:49 ID:fwl/Q2LL

>>10

:/  Still doesn't work.

Name: Anonymous 2007-07-20 15:53 ID:o8DsrFEL

I suspect it's not just LoadModule; Apache would bitch about the rewrite directives if mod_rewrite wasn't loaded.

Redirecting to a seperate host like that requires mod_proxy as well. Note the [PT,L] at the end. Try changing it to [P].

Name: Anonymous 2007-07-20 15:55 ID:o8DsrFEL

Mind you, using mod_proxy like that will probably open you up to abuse. Consider using a normal redirect.

Name: Anonymous 2007-07-20 15:55 ID:fwl/Q2LL

>>12

Ya, still doesn't work.

Name: Anonymous 2007-07-20 15:56 ID:fwl/Q2LL

>>13

That would use the [R] tag, right?  That doesn't work either.

Name: Anonymous 2007-07-20 16:00 ID:o8DsrFEL

Maybe this is why [P] doesn't: "Notice: To use this functionality make sure you have the proxy module compiled into your Apache server program."

I'm surprised [R] doesn't work. Try [R,L]. If that doesn't work either, all I can suggest is looking at the mod_rewrite documentation and trying different thing. mod_rewrite is a fickle beast.

mod_alias might be an adequate alternative too.

Name: Anonymous 2007-07-20 16:02 ID:o8DsrFEL

Oh, I forgot: if you really don't give a shit, and just want it to work, consider using >>4, and putting the redirect inside banned.html's HTML.

It's ugly, gross, and not pretty, but it'll do the job provided you have a sane mod_rewrite install.

Name: Anonymous 2007-07-20 16:21 ID:fwl/Q2LL

>>16

[R,L] doesn't work either.  I have mod_proxy enabled too.  How would I do it with mod_alias?

Name: Anonymous 2007-07-20 19:42 ID:o8DsrFEL

>>18
Depends on whether it's Apache 1.3 or 2.0. The first two hits cover both: http://www.google.com/search?q=mod_alias+apache

May I suggest verifying if >>4 unmodified works? If you're not even getting banned.html, mod_rewrite is borked.

Name: Anonymous 2009-01-14 15:14

lol

Name: Anonymous 2009-02-25 7:22

banned FROM IT FOR   some kind of   game are you   talking about faggot?

Name: Anonymous 2010-11-27 18:20

<

Name: Anonymous 2010-12-26 16:44


Don't change these.
Name: Email:
Entire Thread Thread List