I've asked this question on math.stackexchange before, but it has not been solved.
The following statement appears to be true:
The $q$-ary Hamming code of codimension $r$ over $\mathbb{F}_q$ is equivalent to a cyclic code if and only if if $q-1$ and $r$ are coprime.
See for example this answer on math.stackexchange.
The $\Leftarrow$-direction is not too hard to show (see for example the last paragraph of this answer), but I could not find a proof for the other direction anywhere. I've checked various sources like web search, search on mathoverflow and math.stackexchange, as well as standard books on coding theory like MacWilliams-Sloane, van Lint or Huffman-Pless.
So my question is how to show $\Rightarrow$. Preferably by means available in a typical lecture on algebraic coding theory.