How To Stop Unparked Domain Names Resolving When Using a Dedicated IP In WHM

A few days ago after purchasing a new VPS server & attempting to set up some new websites I stumbled across a pretty annoying problem (a problem which could potentially be disastrous for SEO).

The problem I found was that if you decided to assign a dedicated IP address a website in WHM, then the IP address itself would load up the website, just as if you were to visit via the domain name.

So as an example, if you visited “darlay.com”, you’d see my website (as you’d expect)… But if you also typed in the dedicated IP address that the website was sitting on, that’d load up the website too.

At a glance, it might not seem like too much of an issue… But this also means that any other domain names which have used that IP in the past (and are still actively doing so) will now also resolve to your website.

So “darlay.com” would load up my website… But so might “BarrysWashingMachineRepairs.com”, or “JeffsMustacheGrowingTips.com” and that causes a huge problem for SEO.

If you want to stand any chance of your website performing well in search engines then the one thing you definitely don’t want is lots of random domain names pointing at it.

So How Do We Stop This Problem?

Oddly, I wasn’t actually able to find much information about fixing this particular issue online, but thankfully I came up with a solution & it works pretty well.

It’s also pretty easy to implement through WHM, too.

All you need to do is log in to WHM, then navigate to “Apache Configuration” which is located under “Service Configuration” as pictured below:

Apache Configuration

Then from that page, you want to select the “Include Editor”, again as pictured below:

Apache Include Editor

Now, what we’re going to do is add a “Pre VirtualHost Include”… Which basically means that you’ll basically be adding some rules to the very top of Apaches VirtualHosts configuration.

It’s important the rules go at the top rather than the bottom because Apache takes the rules it sees first as being more important.

So from under the “Pre VirtualHost Include” section click on the dropdown box & select “All versions of Apache”, unless you specifically only want to add the rule for a certain version.

The editor will appear & there are just 2 simple rules that you need to add.

The first one you need to add is a default rule, which basically defines what should happen with any domain names (or IPs etc) that haven’t been added to the configuration (eg unparked domain names).

Here’s the code:

<VirtualHost _default_:80>
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>

That bit of code will stop the unparked domain names from resolving your website – but it won’t stop the IP address itself resolving (since the IP will be listed in the configuration).

This means that you need to add another rule to target the IP address specifically, like so:

<VirtualHost 1.1.1.1:80>
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>

And of course, you can add as many of these rules as you like, for each dedicated IP that you have (but note that you don’t need to duplicate the “default” rule, only the IP specific rule).

You can also change “/usr/local/apache/htdocs” to be a folder of your choice so that you can customize the content that will be displayed to unparked addresses.

If you leave it at “/usr/local/apache/htdocs” then it’ll simply redirect to Apache’s “Default Web Site Page” like you’d see if the tried to directly access the main, shared IP of the server.

Anyway, once those are set you should be good to go – just be sure to restart Apache for the changes to take effect & then also clear your browser cache too. 🙂

Leave a Comment