Redirect IP address to Domain Name in CyberPanel

Every VPS and a dedicated server comes with a dedicated IP address. For example, 192.168.1.1. In CyberPanel, when you directly put this IP address in the address bar, It returns to an error page. You can redirect your server main IP or all other IPs to the master domain or any other domain hosted on your server.

Webs.org provides free advice on marketing, Internet ads, classified ads, domain names, web hosting and website design. It is brought to you by URLs.net.

Redirect IP to Domain in CyberPanel

In this post, we will redirect IP to a domain name using CyberPanel using root level. For this, you need to open your SSH terminal using your root credentials.

Perform the following actions carefully and this setting works only for OpenLiteSpeed

After logging in root, type the following command:

 cat /usr/local/lsws/conf/httpd_config.conf

To edit httpd_config.conf file, you need to type:

nano /usr/local/lsws/conf/httpd_config.conf

After opening this, find the line:

listener Default {

Under this directive Type following line before or above “}” symbol.

map Example *

Now save this file by typing ctrl+X and Y on your pc or computer keyboard.

After this, you have to edit Example/vhost.conf file. To edit this, type the following command.

nano /usr/local/lsws/conf/vhosts/Example/vhconf.conf

There is a rewrite available in this file by default. To delete this find the following code:

rewrite  {   enable                  1   logLevel                9 }

Delete or cut this whole code by using Backspace button on your pc keyboard.

Now scroll file to the last and paste the following command in this file.

rewrite  {   enable                  1   logLevel                9 RewriteCond %{HTTP_USER_AGENT}  ^NameOfBadRobot RewriteRule ^/nospider/         -   [F]  RewriteRule ^/$  http://insidehost.net/? [L,R=301] }

In the above code replace insidehost.net with your domain name.

Redirect IP To Domain In Cyber Panel

Save this file.

Now restart your LiteSpeed server by typing the following command.

/usr/local/lsws/bin/lswsctrl restart

Or Reload the configuration

/usr/local/lsws/bin/lswsctrl reload

Now type your server IP in the Google address bar and hit enter. It will redirect to the domain name.

You’ve done!

The post Redirect IP address to Domain Name in CyberPanel appeared first on InsideHost.

Blog – InsideHost

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.