LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-14-2009, 01:09 PM   #1
chenxiaolong
LQ Newbie
 
Registered: Jun 2009
Location: /home/chenxiaolong and /root and /Users/chenxiaolong and C:\Users\chenxiaolong
Distribution: Fedora 12, Debian 5, Ubuntu 10.04
Posts: 17

Rep: Reputation: 0
Apache Only allow certain IP's and redirect others


I'm using Apache 2 on a Linux server and I was wondering if it was possible to redirect certain IP ranges to another page. I know it's possible to block an IP, but is there a way to block all IP's and only allow a certain IP range to connect, such as 5.87.xxx.xxx? I own this server, so if I need to use another OS, webserver, change configuration files, etc., that's fine.
 
Old 08-14-2009, 01:24 PM   #2
teebones
Member
 
Registered: Aug 2005
Location: /home/teebones
Distribution: sometimes this, sometimes that..
Posts: 502

Rep: Reputation: 56
modrewrite might be helpful

or you can reroute through your firewall (depending on OS, IPtables e.g, to a virtual network device (bonded adapter confg e.g. eth1:1)
and in the apache conf, set the site for that device to respond to.

NameVirtualHost the.ip.address.here:80 (subsitute the.ip.address.here with the real ip)
in apache, and then the rest of the config added to it.

Last edited by teebones; 08-14-2009 at 01:32 PM.
 
Old 08-14-2009, 11:12 PM   #3
chenxiaolong
LQ Newbie
 
Registered: Jun 2009
Location: /home/chenxiaolong and /root and /Users/chenxiaolong and C:\Users\chenxiaolong
Distribution: Fedora 12, Debian 5, Ubuntu 10.04
Posts: 17

Original Poster
Rep: Reputation: 0
Question

How would I do that? The computers within 5.87.*.* should be able to access the index page and all other people get redirected to http://domain.com/alternatesite. I don't want them to be blocked, just redirects. I can't change the 403 error page also because I don't want inaccessible directory listings to be redirected.

By the way, I use Debian and CentOS on my servers, so if I need to install anything, RPM and DEB are okay.

Thank you for your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind Question - How to redirect certain IP's buggabill Linux - Server 1 03-11-2009 01:22 PM
How to prevent local IP's in apache log? esaym Linux - Server 2 02-17-2007 10:53 PM
redirect IP's ?? snoply Linux - Networking 1 03-26-2006 04:07 AM
stopping specific ip's from accessing apache lawadm1 Linux - Software 7 09-26-2004 02:40 PM
Apache and Dynamic IP's ranixlb Linux - Networking 3 05-24-2002 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration