Is there a nontrivial semidirect product of two groups isomorphic to their direct product? Suppose $N$ and $H$ are groups and $\phi: H \rightarrow \operatorname{Aut}(N)$ is a homomorphism. We know that $N \rtimes_{\phi} H = N \times H$ if and only if $\phi$ is trivial, but this question is a bit different.

Does $N \rtimes_{\phi} H \cong N \times H$ imply that $\phi$ is trivial? 

My first idea is that there should be a counterexample, but I haven't been able to figure out anything yet. 
Since nontrivial semidirect products are always nonabelian, we definitely need at least one of $N$ or $H$ nonabelian. I think finding a counterexample to the statement would also be equivalent to finding $G$ such that $G = NH = N'H'$ where 


*

*$N \cap H = N' \cap H' = 1$

*$N \cong N'$ and $H \cong H'$ 

*$N, N', H' \trianglelefteq G$  but $H$ is not normal in $G$
 A: Consider $N=A^{\mathbb N}\times B^{\mathbb N}\times C^{\mathbb N}$ and $H=B$, where $C=A\rtimes_\phi B$.
Let $\Phi(h)(a_0, a_1, \ldots; b_0, b_1, \ldots; c_0, c_1, \ldots)=(\phi(h)(a_0), a_1, \ldots; b_0, b_1, \ldots; c_0, c_1, \ldots)$.
This makes
$$ B\rtimes_\Phi (A^{\mathbb N} \times B^{\mathbb N}\times C^{\mathbb N})\cong(B\rtimes_\phi A)\times A^{\mathbb N}\times B^{\mathbb N}\times C^{\mathbb N}=C\times A^{\mathbb N} \times B^{\mathbb N}\times C^{\mathbb N}\\\cong A^{\mathbb N}\times B^{\mathbb N}\times C^{\mathbb N}\cong B\times (A^{\mathbb N} \times B^{\mathbb N}\times C^{\mathbb N}).$$
Note that I use repeatedly that $X\times X^{\mathbb N}\cong X^{\mathbb N}$.
A: Here is just an elaboration of Derek Holt's answer:
Each $n\in N$ defines an inner automorphism
$$\sigma_n:N\to N,\qquad x\mapsto nxn^{-1}.$$
The function
$$\rho:N\to\operatorname{Inn}(N),\qquad n\mapsto\sigma_n$$
is then a (surjective) group homomorphism, and
$$\ker\rho=Z(N).$$
Now suppose that $Z(N)=1$. Then $\rho$ is an isomorphism. Now let
$$\phi:H\to\operatorname{Inn}(N)$$
be a group homomorphism. If $h\in H$, then $\phi(h)=\sigma_{\xi(h)}$ for some unique $\xi(h)\in N$. This defines a function
$$\xi:H\to G,$$
and since $\phi$ is a group homomorphism,
$$\sigma_{\xi(h_1h_2)}=\phi(h_1h_2)=\phi(h_1)\phi(h_2)=\sigma_{\xi(h_1)}\sigma_{\xi(h_2)}=\sigma_{\xi(h_1)\xi(h_2)}.$$
Since $\rho$ is an isomorphism, this implies that
$$\xi(h_1h_2)=\xi(h_1)\xi(h_2)$$
for all $h_1,h_2\in H$, i.e., $\xi$ is a group homomorphism. Now define
$$\psi:N\rtimes_\phi K\to N\times H,\qquad (n,h)\mapsto(n\xi(h),h),$$
and
$$\eta:N\rtimes_\phi K\leftarrow N\times H,\qquad (n\xi(h)^{-1},h)\mapsto(n,h).$$
One can check that $\psi$ and $\eta$ are group homomorphisms, and that they are inverses of each other.
A: In general, if ${\rm Im}(\phi) \le {\rm Inn}(N)$ then $N \rtimes_{\phi} H \cong N \times H$. So the smallest example is with $N=S_3$ and$|H|=2$.
Added later: unfortunately, what I wrote is not true in general! For example, let $G$ be a central product of the quaternion group $Q_8$ of order 8 (the dihedral group of order 8 would work, too) with a cyclic group $C_4$ of order 4, amalgamating the central subgroups of order 2 from the two groups. So $|G|=16$. Then, the product $xy$ of $x \in Q_8$ and $y \in C_4$ with $|x|=|y|=4$ has order 2, and so $G$ is a semidirect product $Q_8 \rtimes C_2$ where the automorphism induced by the action is inner, but it is not isomorphic to $Q_8 \times C_2$.
What you can say, is that if ${\rm Im}(\phi) \le {\rm Inn}(N)$ in $G = N \rtimes_{\phi} H$, then $G=NC_G(N)$ so, if $Z(N)=1$ (which is the case in the example above with $N=S_3$), then we do have $G \cong N \times H$.
