Skip to main content

How to redirect IP address to domain?

Comments

4 comments

  • cPanelLauren
    You can't do this for http connections without a dedicated IP address, the default page is to be expected. Over https, the first VirtualHost in the configuration on that IP address would be displayed and that may be a solution but ultimately the way to address this is for the user to have a dedicated IP address. In that circumstance, the IP would be assigned to that user's sites and display the VirtualHost associated with their IP.
    0
  • jndawson
    You can't do this for http connections without a dedicated IP address, the default page is to be expected. Over https, the first VirtualHost in the configuration on that IP address would be displayed and that may be a solution but ultimately the way to address this is for the user to have a dedicated IP address. In that circumstance, the IP would be assigned to that user's sites and display the VirtualHost associated with their IP.

    So, that would be, "No, you can't redirect a specific IP-based URL to a domain on another server."
    0
  • cPanelLauren
    So, that would be, "No, you can't redirect a specific IP-based URL to a domain on another server."

    No, that's incorrect. You can do this for dedicated IP addresses. You can also do this over HTTPS because of Apache's default behavior for SSL VirtualHosts. You cannot do this for a shared IP over HTTP. If you're looking to change the default page to something else you CAN do that, you could potentially just redirect the default page itself somewhere else using a PHP redirect. Something like the following: < ?php header("Location: http://www.redirect.to.url.com/"); ?>
    But this would redirect ALL instances of the default page. If you want to employ this kind of redirect for the page you can do so at WHM>>Account Functions>>Web Template Editor. mod_userdir (which is what your URL format uses) might be able to utilize this kind of redirect as well now that I think about it. If you add the PHP into the header of the page after ensuring that the page displays with mod_userdir (i.e., mod_userdir protection is not enabled at WHM>>Security Center>>Apache mod_userdir Tweak) the PHP for that redirection should function.
    0
  • PCZero
    I am reviving this thread to ask how to accomplish someting that is an extension of this issue. How do I redirect With or without https(s) With or without www or any subdomain ###.###.###.### With or without any port designator (:443) With or without any page (index.php) Basically redirect ANY call to the main server IP from someone browsing the web to a set URL (
    0

Please sign in to leave a comment.