I am wanting to restrict access to a website to people inside of my network. If someone from outside hits the site they will be redirected to another page.
How do I configure these two different actions based on IP address?
|
|
|
Since you don't want to just prevent page loads from the external networks, but want to send them to a different page, you will need to use mod_rewrite. Assuming your local net is 192.168.1.0/24:
You don't actually need to restrict the page, because the rewrite rules will ensure that the foreigners never see the page. Note, this is not completely tested, but should get you down the path you want. |
|||
|
|
|
Here is what finally worked! Thanks for everyone's help getting me close.
|
|||
|
|
|
The restriction is done as follows:
Then, if you want an automatic redirection for users outside of your local subnet, you'll want to modify the default handling of "403 Forbidden". My example redirects to "index.php".
|
|||||||||
|
|
try this order deny, allow deny from all allow from 192.168 |
|||
|