Liquid crystal photonic devices are becoming increasingly popular. These devices often present a challenge when it comes to creating a robust alignment layer in pre-assembled cells. In this paper, we describe a method of infusing a dye into a microcavity to produce an effective photo-definable alignment layer. However, previous research on such alignment layers has shown that they have limited stability, particularly against subsequent light exposure. As such, we further describe a method of utilizing a pre-polymer, infused into the microcavity along with the liquid crystal, to provide photostability. We demonstrate that the polymer layer, formed under ultraviolet irradiation of liquid crystal cells, has been effectively localized to a thin region near the substrate surface and provides a significant improvement in the photostability of the liquid crystal alignment. This versatile alignment layer method, capable of being utilized in devices from the described microcavities to displays, offers significant promise for new photonics applications.