Change default vhost

HMTKSteve

Verified User
Joined
Jan 18, 2009
Messages
78
I would like to change the default vhost that appears when someone tries to access a domain that no longer exists on the server. Right now it goes to /var/www/html but I want it to go to www.defaultdomain.tld instead.

Where and how do I make this change?

Thanks in advance.
 
Code:
mv /var/www/html/index.html /var/www/html/index.html.back

Now create /var/www/html/index.php with the following content:
Code:
<?php
header("Location: http://[URL="http://www.defaultdomain.tld/"]www.defaultdomain.tld[/URL]");
?>

P.S. There are more possible ways to do that (if you need them - just let me know).
 
Hi,

You could do one of two things without muddling in your vhost file.

1. Just put your content into /var/www/html if you want say a static page for them to see.

2. Symlink /var/www/html to your defaultdomain.tld directory.

Hope that helps.
 
Back
Top