A signal‐off photoelectrochemical (PEC) aptasensor was proposed for pathogenic bacteria detection based on graphite‐like carbon nitride decorated with NiO. The S. aureus be captured by the specific recognition of DNA aptamer, which was immobilized on the PEC electrode surface according to the specific effect of carboxylic group and NiO. The PEC signal would be obviously suppressed due to the transfer blocking of electron donor to PEC active material surface by steric hindrance and electrostatic repulsion. The PEC aptasensor showed excellent specificity and high sensitivity for S. aureus, and this provides simple strategy to construct point‐of‐care testing aptasensor for bacteria analysis.