Connect to another server when the principal fails? [closed]

0

I have a query regarding hosting and linux servers. Suppose I have the web www.miweb.com, which has DNS 123.123.123

There is some way that when the server is offline due to some technical problem, it will automatically be redirected to another auxiliary server, so we would have two servers and it would never be offline.

Then when the main server is online again, we use this one.

If the web is dynamic, and it is saved info in database and others, how can I keep both servers updated?

Thank you very much!

    
asked by Enzo Balmaceda 31.05.2018 в 15:22
source

1 answer

1

In most cases, a .htaccess file or a PHP script is used to redirect a domain. The advantage of these methods is that it is possible to individually define which HTTP status code should be displayed to the user agent, thus characterizing the redirections as temporary or permanent. Thus, two HTTP status codes, 301 and 302, are particularly relevant:

301 – Moved Permanently: la página solicitada por el agente de usuario estará disponible de manera permanente bajo la URL redireccionada. La antigua URL será, por lo tanto, inválida. 

302 – Moved Temporarily: la página solicitada por el agente de usuario está temporalmente disponible bajo la nueva URL. A diferencia de la redirección 301, la antigua dirección sigue siendo válida.

In case the HTTP status code is not specifically defined, the server will default to a status code of 302, which is not always ideal. Therefore, it is advisable to manually enter all status codes to avoid indexing errors such as URL Hijacking. Unlike redirect 301, status code 302 tells the crawler that the original URL must continue to be indexed. If active, the old URL will compete with the new one in the search engine index.

See if through an error you can redirect it to another hosting with .htacess

    
answered by 31.05.2018 в 15:26