This guide details the process of configuring non-existent sites and IP addresses to redirect to a specific site or default webpage, rather than serving content from the first VirtualHost entry associated with the IP address to which the domain resolves.
If a domain resolves to an IP address on a server but does not correspond to any existing site on the server, Apache defaults to serving content from the first site bound to that IP address.
Follow the steps:
- To modify this functionality, you must include a new VirtualHOST directive in
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf to ensure it takes precedence as the first VirtualHOST. - It is important to be aware that creating a custom VirtualHost might lead to unforeseen consequences, and these adjustments should only be undertaken if you are proficient in troubleshooting VirtualHost problems in Apache.
- Please note that cPanel support does not offer direct assistance for Apache configuration customizations.
Follow the procedure:
- Log in to WHM.
- Select the “Service Configuration” option and click on the “Apache Configuration” sub-option.
- Select the “Include Editor” option.
- Under “Pre Virtual Host Include”, select the “2.4.X” Apache version.
- Select the “All versions” option.
- In the opened dialogue, insert the VirtualHost for the specified IP address across the web server ports.
- Proceed by selecting “Update”, and then subsequently select “Restart Apache”.
In this way, you can set a default VirtualHost for each IP address. Should you require assistance, contact our support staff. They are available 24×7.