# apache server question

**URL:** https://boards.straightdope.com/t/apache-server-question/142768
**Category:** Factual Questions
**Created:** [December 14, 2002, 7:25pm UTC](https://boards.straightdope.com/t/apache-server-question/142768 "2002-12-14T19:25:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![raisinbread](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@raisinbread](https://boards.straightdope.com/u/raisinbread)
#### Post date: [December 14, 2002, 7:25pm UTC](https://boards.straightdope.com/t/apache-server-question/142768/1 "2002-12-14T19:25:01Z")

</div>

I want to keep someone from viewing my site but I want them to know it by having them access my domain or any page within my domain but they’re automatically redirected to a page made up just for them.  
How does one do this?

---

<div class="post-metadata">

### Author: ![black\_rabbit](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@black\_rabbit](https://boards.straightdope.com/u/black_rabbit)
#### Post date: [December 14, 2002, 7:48pm UTC](https://boards.straightdope.com/t/apache-server-question/142768/2 "2002-12-14T19:48:55Z")

</div>

You’ll need to edit .htaccess to do a redirect for specified IPs.

Here’s a start:

[http://www.javascriptkit.com/howto/htaccess5.shtml](http://www.javascriptkit.com/howto/htaccess5.shtml)

If you’re using PHP, you can do something like

```auto

<?
if ($REMOTE_ADDR = 123.456.789) {
header("Location: screwyou.html") }
?>

```

The redirected person needs a static IP, though.

---

<div class="post-metadata">

### Author: ![black\_rabbit](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@black\_rabbit](https://boards.straightdope.com/u/black_rabbit)
#### Post date: [December 14, 2002, 7:50pm UTC](https://boards.straightdope.com/t/apache-server-question/142768/3 "2002-12-14T19:50:10Z")

</div>

Whups, make that  
…  
header(“Location: screwya.html”) **;** }

---

<div class="post-metadata">

### Author: ![raisinbread](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@raisinbread](https://boards.straightdope.com/u/raisinbread)
#### Post date: [December 14, 2002, 7:51pm UTC](https://boards.straightdope.com/t/apache-server-question/142768/4 "2002-12-14T19:51:38Z")

</div>

I don’t have their IP address but I do have their address which is like this:  
[city.state.isp.net](http://city.state.isp.net) but the stuff before it is always somewhat different. Would I be able to use \* as a wildcard like this in lieu of having an IP address? Like this?

\*.city.state.isp.net

Sure everyone in their city from that state wouldn’t be able to see my page but no one else from there checks out my site.

---

<div class="post-metadata">

### Author: ![Vic\_Ferrari](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@Vic\_Ferrari](https://boards.straightdope.com/u/Vic_Ferrari)
#### Post date: [December 14, 2002, 8:28pm UTC](https://boards.straightdope.com/t/apache-server-question/142768/5 "2002-12-14T20:28:55Z")

</div>

Remember that people can use web-based anonymizers to mask their ip address. They could also simply change their ISP or go to a web cafe to foil your ip address re-director.

It’s pretty much impossible to keep one person out while allowing everyone else in, it’s much easier to allow certain people in and keep everyone else out.

---

<div class="post-metadata">

### Author: ![Una\_Persson](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/una_persson/32/346_2.png) [@Una\_Persson](https://boards.straightdope.com/u/Una_Persson)
#### Post date: [December 15, 2002, 12:04am UTC](https://boards.straightdope.com/t/apache-server-question/142768/6 "2002-12-15T00:04:55Z")

</div>

Do a reverse whois or nslookup on the domain, find out what IP addresses it uses, and ban the entire ISP. Or the entire top-level domain.

It’s what I typically do. Then I just wait until someone complains by e-mail, and I increase the granularity of the ban so they can get in.
