We demonstrate an optical sensor for the detection of ammonia in gaseous phase under a changing humidity environment. The sensor is based on a sectioned nano-structured porous silicon (PSi) device in which the parts react distinctly to ammonia and water vapor. The distinct sensing is necessary since most ammonia indicators' sensitivities are highly dependent on the ambient relative humidity. The sensor is interrogated with a single white-light beam, and changes in the reflectivity sensor are monitored. The combined interference pattern from both PSi sections is observed and measured under various concentrations of ammonia and water vapor. The structure is designed to frequency encode the reflectivity spectrum and Fourier-transform data-analysis is applied in order to enable simple discrimination between different ammonia and water vapor concentrations. The method allows remote and distance-insensitive analysis of gases in breath and other gaseous environments.