Re: Cacthing hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 26, 2010 at 10:52 PM, Frank Gingras <francois.gingras@xxxxxxxxx> wrote:


On 02/26/2010 12:12 PM, Tom Evans wrote:
On Fri, Feb 26, 2010 at 4:57 PM, Nilesh Govindarajan<lists@xxxxxxxxxx>  wrote:
Hi,

I have two domains, example.net and example.com

*.example.net&  *.example.com point to the server's IP (Wildcard CNAME).

Now only some subdomains like www, img, etc. are defined on both domains.

I want to catch all other subdomains not configured and raise a 404 error.

How to ?

--
Nilesh Govindarajan
Site&  Server Administrator
www.itech7.com



I don't know about 404, but you can have them raise a 403 easily enough:

<VirtualHost *:80>
  ServerName www.example.com
</VirtualHost>

<VirtualHost *:80>
  ServerName *.example.com
  RewriteEngine On
  RewriteRule ^ - [F]
</VirtualHost>

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See<URL:http://httpd.apache.org/userslist.html>  for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


Tom,

Note that using a wildcard with ServerName is not recommended. If you want to define a dummy catch-all vhost, you should place it first, and set the ServerName to another value like your IP or a dummy name.

Frank.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
 "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


Though I've got it, I have a doubt. I'm using this config -

<VirtualHost *:80>
ServerAlias *.example.com *.example.net
RedirectMatch 400 ^/(.*)$
</VirtualHost>

This configuration has to be placed after all good vhosts; Otherwise all hosts give Error 400. Why ?

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux