Control Web Panel

Other => Other => Topic started by: ahmedalnagar on August 23, 2019, 09:16:25 AM

Title: Can I redirect the server's IP to a domain?
Post by: ahmedalnagar 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
Title: Re: Can I redirect the server's IP to a domain?
Post by: rcschaff 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
Title: Re: Can I redirect the server's IP to a domain?
Post by: Igor S. 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