Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following httpd configuration to allow subdomains and to redirect www url to non-www url:

ServerName example.com:80

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName example.com
  ServerAlias (a([c-g]|i|[l-o]|[q-u]|w|x|z)|z(a|m|w)).example.com
</VirtualHost>

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

I want to test that these settings are valid. I thought initially that placing those urls in the hosts file would enable me to do that. But it doesn't seem so as any subdomains that does not match ServerAlias in virtual host can still run. So can this be done without a DNS?

share|improve this question
up vote 0 down vote accepted

You could telnet to localhost:80 and manually issue the HTTP requests then check that you receive the correct response.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.