Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.