Path planning for Unmanned Aerial Vehicles (UAVs) has gained significant importance in recent times because of their autonomous operations in diverse applications areas. The aim of this study is to plan optimal paths for unmanned aerial vehicles that avoid some forbidden regions during its operation. Most of the literature on UAV path planning try to solve planning problem with numerous assumptions on operational environment. In this study, we propose a generic optimal path planning algorithm by using Direct Collocation Non-Linear Programming (DCNLP) approach with Hermite-Simpson transcription. DCNLP transcribe an optimal control problem into nonlinear program and solve it with numerical optimization techniques. DCNLP algorithm is successfully applied to the generation of UAV trajectories that avoid forbidden regions and traverse their path only through safe regions during its operation. We modelled forbidden regions with simple sinusoidal functions that produce a map of forbidden regions on 2D regions. Simulation result in MATLAB using Optimization Toolbox show that it is possible to generate offline trajectories for unmanned aerial vehicle that avoid forbidden regions without any specific initial guess.