Incoming redirects by network range

I wanna redirect incoming networks, not just specific IP's with Apache, would this be correct?

RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^192\.168\.0\.0$
RewriteRule .* http://www.google.com

1 Reply

I think it would need to be more along the lines of the following since it's a regex comparison, and Apache isn't aware of the CIDR / network address in this module.

RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^192\.168\.0\.[0-9]{1,3}$
RewriteRule .* http://www.google.com

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct