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.

Website by IP and domain both load. Should this be solved by CPanel?

Discussion in 'General Discussion' started by Citizen, Nov 30, 2012.

  1. Citizen

    Citizen Active Member

    Joined:
    Sep 3, 2012
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Basically if I type in my ip address (for example. 1.2.45.67) into my address bar, it loads my website, which I believe could count as duplicate content. I know there are solutions to check hostname in htaccess and redirect, but is this something that can or should be solved by cpanel or should I go the htaccess route?
     
  2. STS Admin

    STS Admin Well-Known Member

    Joined:
    Jul 8, 2012
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Try the below code in your .htacess by replacing IP and domain

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^123\.123\.123\.123
    RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
     
  3. Citizen

    Citizen Active Member

    Joined:
    Sep 3, 2012
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks, that did the trick.
     
Loading...

Share This Page