Access site by IP address on Apache/Cpanel/WHM server

Posted on 2007-10-12
Medium Priority
Last Modified: 2008-01-09

I have the following configuration in my httpd.conf file:


ServerAlias www.mydomain.com
DocumentRoot /home/mydomain/public_html

For some reason when I am trying to access the site using the IP address I don't see the contents of /home/mydomain/public_html directory (I have a specific index.html there) but I see the server's default page.

Basically I am looking to transfer a site on that server and during the DNS change I want the users to be able to access the site using the new IP on their browsers (the old site will re-direct to the new IP).

Any ideas?
Question by:infodigger
LVL 29

Accepted Solution

Jan Springer earned 2000 total points
ID: 20064915
You can either provide a unique IP for the new site or another hostname.

The hostname method is usually what I do.  Add www2.domain.com to your DNS and in Apache:  
   ServerName www.domain.com
   ServerAlias www2.domain.com

Then just redirect to the new domain.

When you change the address record for www to the new IP, Apache will respond accordingly.

Author Comment

ID: 20065106
Lol:) How did I not think about that? !!

Thanks so much for the tip!

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question