The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Prevent open website from IP

Discussion in 'General Discussion' started by Milan23, May 10, 2014.

  1. Milan23

    Milan23 Registered

    Joined:
    May 10, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi.
    I have a dedicated server for my website.
    Today I created a subdomain with CNAME (Advanced Editor Zone).
    but when Im opening the subdomain (for expamle sub.domain.com), its redirected to sub.domain.com/cgi-sys/defaultwebpage.cgi.
    so I searched and find this soloution: in /usr/local/apache/conf/httpd.conf changed DocumentRoot to /home/account/public_html.
    my problem solved and subdomain opened my subdomain correctly.
    but now when a user enter server IP, the website opened (/home/account/public_html).
    How can I prevent opening website with server IP?
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Pardon me for asking what may be a silly question but:
    Why? I suppose there's a reason you did, I'm just not sure what it would be offhand.

    You can change to doc root in the same area you created the sub domain. There should be no need to do this.

    You might want to reverse any changes you made in all areas and give it another go, using the proper tools you have in cPanel.
     
  3. Milan23

    Milan23 Registered

    Joined:
    May 10, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks for your help.
    For some reasons I want our visitors can access our domain content from subdomain, without redirect. So I created a CNAME for this.

    In Advanced DNS Zone Editor there is an option for this? I create cname with these data:
    Name: sub.domain.com
    TTL:14400
    Type:CNAME
    CNAME:domain.com
    but sub.domain.com redirected to cgi-sys/defaultwebpage.cgi before changing httpd.conf.
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    What redirect do you speak of? Creating a sub domain in cPanel should work as expected. But since you mention a redirect, I have to assume (since I'm not sure what the issue is here exactly) you're not setting up a sub domain on the same server as the main domain. Or am I mistaken?
     
  5. Milan23

    Milan23 Registered

    Joined:
    May 10, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    "Without Redirect" means when users going to sub.domain.com, the page doesn't redirect to domain.com. Instead of this, when user going to sub.domain.com can explore website with this links for example: sub.domain.com/index.php , sub.domain.com/dir/index.php.
    for this, I created CNAME.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    If it's a shared IP address, you can sometimes ensure it loads the default cPanel page by running the following command:

    Code:
    /scripts/rebuildhttpdconf
    Otherwise, follow the instructions here:

    Default page for IP Address

    Thank you.
     
Loading...

Share This Page