Difference between Allí and Ahí

From diff.wiki

When learning Spanish adverbs, a little confusion may result from trying to understand the use of allí and ahí. Some people insist on using them as synonyms and exchanging their meanings. Although this is not entirely incorrect (whether if one uses ahí or allí, the phrase is most likely to be understood anyways) there are some characteristics that are convenient to take into account before using one or the other.

Allí Ahí
Definition Allí is an adverb of place. It literally means “in that place” or “there”. Allí has been falling into disuse for some time now, so it is not that common. As for ahí, it is also an adverb of place. Ahí also means “there”. Since most people don’t really use allí anymore, ahí is the word that comes to replace it.
Location Allí talks of an exact location. Ahí on the other hand, talks about a more general location than allí. It is not specific.
Closeness Although allí is much more specific tan ahí, it also talks about something that is not necessary close to whomever speaks. On the other hand, ahí is understood as something that is relatively close from whomever speaks.
Examples ''Te he dicho mil veces que el salero está allí, justo al lado de los vasos.

Justo allí fue donde el coche de Alejandra se estrelló.

Decía mi abuelo que ahí por el año de 1910, su padre enterró oro en este patio.

Ahí, cerca de la alberca fue donde encontré al cachorro de mapache.''