Using finite-difference time-domain simulation, we show that ultrahigh-Q nanocavities can be obtained through the manipulation of a single semiconductor nanowire (NW) inside a slot in a line defect of a two-dimensional photonic crystal. By controlling the design and its lattice parameters of the photonic crystal, we have achieved a quality factor Q larger than 106 and a mode volume Vc smaller than 0.11 μm3 (1.25 of a cubic wavelength in the NW) for a cavity peak in the telecommunication band. This design is useful for realizing a position-controlled cavity in a photonic crystal. Here, we also discuss the small dependence of the Q-factor, the Vc, and the cavity peak in relation to the position of the NW inside the slot and the potential application to the cavity quantum electrodynamics using the embedded-emitter NW.