We obtained (necessary and sufficient) conditions on the weight functions $v_0$, $v_1$ and $w$ for the imbedding $W^{1,p} (\Omega; v_0, v_1) \hookrightarrow W^{1,p}(\Omega; w)$ where $\Omega$ is an unbounded domain with nonempty boundary. It is shown that in the case when $v_0 = v_1$ the imbedding holds under weaker conditions.