Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am using named Virtual hosts

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/usr/local/apache2/docs/thegeekstuff"
    ErrorLog "logs/thegeekstuff/error_log"
    CustomLog "logs/thegeekstuff/access_log" common

<VirtualHost *:80>
    DocumentRoot "/usr/local/apache2/docs/top5freeware"
    ErrorLog "logs/top5freeware/error_log"
    CustomLog "logs/top5freeware/access_log" common

At the moment i have not defined but when i open in browser it goes to my

Is there any way that if i did not explicitly define that it redirect to either APache conf page

Also if i type ip address only then it also goes to that site.

I want that also to go to that undefiend page or something else

share|improve this question

1 Answer 1

The site that gets served when no <VirtualHost> matches for that NameVirtualHost is the first one to load.

Just put a <VirtualHost> block above your others with a bogus ServerName, which serves the content that you want to be default.

share|improve this answer
so u mean first i need to have default index.html at location like /var/www/default/index.html then in serverbname i use then evrything will go there – user1513613 Jul 5 '13 at 8:10
@user1513613 Right, you will create a separate <VirtualHost> block that will be used as the default for catching requests to domains that aren't covered by a different one. – Shane Madden Jul 5 '13 at 9:14

Your Answer


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.