Author Topic: Can I redirect the server's IP to a domain?  (Read 11921 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Can I redirect the server's IP to a domain?
« on: August 23, 2019, 09:16:25 AM »
Hi friends
Can I redirect the server's IP to a domain?
I want to redirect the server ip to a domain and direct the control panel from the ip to the domain can I do that
كن في الحياه كعابر سبيل واترك وراءك كل اثر جميل فما نحن في الدنيا الا ضيوف وما على الضيوف الا الرحيل

Offline
****
Re: Can I redirect the server's IP to a domain?
« Reply #1 on: January 26, 2020, 04:04:05 PM »
you could use 301 redirects in the proper software config.

nginx:
server {
        listen [ip]:80;
        listen [ip]:443 ssl;
        server_name [ip];
        root /some/directory/to/server/files/but/not/used
        return 301 https://example.com$request_uri;
}
*** Alternatively, you can set one of your websites as listen [host]:443 default_server ssl;

Apache:
<VirtualHost [ip]:80>
    ServerName [ip]
    Redirect 301 / https://example.com/
</VirtualHost>
<VirtualHost [ip]:443>
    ServerName [ip]
    Redirect 301 / https://example.com/
</VirtualHost>

If you use Varnish, it get's complicated quickly
Google Hangouts:  rcschaff82@gmail.com

Offline
*****
Re: Can I redirect the server's IP to a domain?
« Reply #2 on: January 29, 2020, 09:43:35 AM »
Also, you can add .htaccess to /usr/local/apache/htdocs/ and make the redirect there.
Something like: Redirect / http://some_domain
You can ask me to solve any problem with your server for some money in pm  ;)
Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor
Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp

Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services