G
G
gm25852016-06-07 00:58:31
CMS
gm2585, 2016-06-07 00:58:31

How to hide the IP address of the server in the address bar of the site?

There is a VDS, on it CMS Prestashop and presumably Apache (CMS was installed out of the box). When you enter the site's domain in the address bar, the site opens and the server's IP address appears in the address bar. It is also possible to access the site by entering the IP address of the server in the address bar.
Please tell me how to make it so that you can only access the site's domain and block the opening by the server's IP address?
And how to make sure that the address bar of the site does not display the server's IP address when navigating through the pages of the site, but always displays only the domain name?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2016-06-07
@gm2585

if apache then in .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} !^mysite.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]

if nginx then in its config:
if ($http_host !~ "^mysite.com$"){
rewrite ^(.*)$ http://mysite.com$1 redirect;
}

A
Alexander Borisovich, 2016-06-07
@Alexufo

configure Apache to receive only from the domain and that's it) how? write to hosting support - you can’t just tell

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question