Direct IP in URL bar does not load website, how to fix this?

HostedNoob

New Member
I have been researching this and I do not know how to have the IP of my server/website actually load mywebsite and not load a default CPanel page such as the one below. Do I need to change something in my DNS? My websit works fine by domain name obviously, but I want to fix this for SEO purposes.

Capture.PNG
 
@HostedNoob,

This is because your site is set to use the main shared IP in WHM. Set the cPanel account in WHM to have a dedicated IP and then you'll be able to access it directly via the IP.
 
Interesting, I see what you mean, but reviewing all of WHM I do not see where to adjust this setting. Do you have an article you could refer me to?
 
Actually I believe I found the area, WHM >> IP Functions >> change Sites IP address, but for some reason it is not letting me assign it to one account as it is assigned to one of my name servers, root and nobody plus my account. Anyway to fix this?
 
Hi HostedNoob,

In order to assign that IP to a specific domain you'd have to remove it from the nameserver. However really only the only reason you should need a dedicated IP is for SSL. Shared IP numbers are very common and literally thousands of domains and be hosted on a single IP.

If you need to access your domain before DNS propagation happens then you can do that by trying http://<xxx.xxx.xxx.xxx>/~<acctname>. Replacing the Xs with your IP number and putting in your account name after the tilde. This is a configured option in WHM and to turn it on in WHM go to Security Center | Apache mod_userdir Tweak and either uncheck the box or check to disable it for that particular domain.
 
I see and that makes perfect sense now. But for SEO reasons I want to have my IP resolve to my domain name. So perhaps the best thing to do would be for me to purchase an extra IP address and assign that the cpanel account/website I want to display when using the IP directly in the URL bar. That should work fine correct if I get another dedicated IP assigned to my WHM and then I can assign it to that account?
 
Hi HostedNoob,

I'm sure someone will correct me if I'm wrong but I don't think having a dedicated IP has anything to do with SEO.

That aside what you have stated is correct, yes.
 
I have seen some back and forth about that since Google can and does index IP addresses now. I just want my site to load a website when they use the IP address and not a nondescript cpanel webpage. I will be ordering an extra IP on my account. Sorry I am just too OCD to not do it haha, but thank you gentleman for your help.
 
That is a good point, but I will be using an htaccess rule that essentially redirects the ip to the domain name instead. That will fix the dupe content issue. You can think of this as the same thing to do if you redirect www. requests to a non www version of the site. It always keeps the content going to "one" version of the site.
 
I did find a workaround for this issue by modifying my httpd.conf file with the logic below. Not the best solution, but redirects to the domain I want.

Redirect 301 /cgi-sys/defaultwebpage.cgi http://mysite.com/

<Directory "/usr/local/apache/htdocs">
Options Includes Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Redirect 301 /cgi-sys/defaultwebpage.cgi http://mysite.com/
</Directory>
 
I did find a workaround for this issue by modifying my httpd.conf file with the logic below. Not the best solution, but redirects to the domain I want.

Redirect 301 /cgi-sys/defaultwebpage.cgi http://mysite.com/

<Directory "/usr/local/apache/htdocs">
Options Includes Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Redirect 301 /cgi-sys/defaultwebpage.cgi http://mysite.com/
</Directory>

If the changes weren't distilled, they'll be overwritten at the next Apache recompile or anytime cPanel has to touch the Apache conf. This is why changes to httpd.conf aren't recommended as they won't last unless distilled, and sometimes that doesn't even make them stick.

VPS plans from US hosting company KnownHost - Guaranteed 99.9% Uptime with 24/7 Support.
 
If you have multiple domains on your server, it is fairly easy to move one of them to your second IP address. You would need to create a new DNS zone for the domain using the secondary IP address, then create a virtualhost entry for the domain in httpd.conf using the pre_virtualhost_global.conf include file. This would create a dedicated IP for the domain and would allow you to access the "homepage" via the domain name or via the IP address. I've done this on my server and it works great, though to be honest I did it for other reasons...the dedicated IP address was a bonus.

NOTE: I don't think the above will work with the primary domain associated with your account. I suspect you would need to change the primary domain to one of the other domains on your server, then make adjustments in WHM/cPanel to relect the change in primary domain, before you could perform the above procedure.

If you only have one domain on your server, I'm sure it's possible to edit its DNS zone to the alternate IP address, and create a vhost.local file that edits the main virtualhost entry to use the alternate IP address. If you're fluent in PERL this would be a fairly easy task; otherwise, it's probably not worth the effort.
 
Top