V
V
vovkka2016-04-05 14:08:10
css
vovkka, 2016-04-05 14:08:10

How to find out if the site is running locally or if you are accessing the production server?

Good day. Tell me please. there is a local server (open server) there is a combat site for example test.ru and there is a locally launched copy of it with the same name. Actually the question is: when you are developing something locally, how do you know if the site has started locally or if you go to the production server? the names are the same + one more question: when starting the open server, it does not immediately transfer to the local site, from 5-10 times only through ctrl + f5, what could be the problem? (in the hosts file, the open server generates everything automatically). Browser: chrome. Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Aksentiev, 2016-04-05
@Sanasol

Who even makes the same names for the local and production site?
Why punish yourself like that?

A
Andrey Andreev, 2016-04-05
@b0nn1e

I support Alexander Aksentiev , I always made local sites .loc, like example.loc/

M
Mr Crabbz, 2016-04-05
@Punkie

Find out - in f12, in the "network" tab, the IP is shown for each downloaded resource.
"from 5-10 times only through ctrl + f5," - just restart the browser after starting the openserver. If browsers monitored your hosts every half second, you would have an extra load on the processor. And so after starting the browser every time it checks the hosts file.

A
Alexey, 2016-04-05
@alsopub

Try to look at the 'SERVER_ADDR' environment variable, I hope the ips of the local and working servers are at least different for you.
If you have php, then $_SERVER['SERVER_ADDR'].

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question