The development of porous nanostructured materials, such as polymer Bragg gratings, offer an attractive and unique platform for chemical and biological recognition elements. Much of the efforts in polymeric gratings have been focused on holographic polymer dispersed liquid crystal (H-PDLC) gratings with demonstrated applications in switching, lasing, and display devices. Here, we present the application of porous polymer photonic bandgap structures produced using a modified holographic method that includes a solvent as a phase separation fluid. The resulting gratings are simple to fabricate, stable, tunable, and highly versatile. Moreover, these acrylate porous polymer photonic bandgap structures were generated using a simple one-beam setup. In this paper, we describe the application of these nanoporous polymer gratings as a general template for biochemical recognition elements. As a prototype, we developed an oxygen (O 2) sensor by encapsulating the fluorophore (tris(4,7-diphenyl-1,10-phenathroline)ruthenium(II) within these nanostructured materials. Thus, the obtained O 2 sensors performed through the full-scale range (0%-100%) with a response time of less than 1 second. Most importantly, the use of the inherent property of these gratings to transmit or reflect a particular wavelength spectrum, based on the grating spacing, enables us to selectively enhance the detection efficiency for the wavelengths of interest.