At the beginning of the period of transition from petroleum-based fuels to alternative green fuels, determining the optimal location of alternative fuel stations (AFSs) would be an important task. This paper addresses this issue under two main assumptions. First, the capacity of AFSs is limited and each AFS can only serve a number of vehicles up to its capacity. Second, drivers may have to deviate from their pre-determined shortest path to get refueling services. This problem is formulated as a mixed integer linear programming (MILP) model and a heuristic algorithm is developed to solve it. The heuristic method involves solving small and easy to solve linear programing (LP) models, embedded within a greedy approach, and hence, it requires an LP software. Although the proposed MILP model requires that the set of deviation paths be pregenerated with respect to the maximum tolerated deviation distance, the heuristic uses only a restricted set of such paths. The performance of the proposed model and algorithm is evaluated on some randomly generated instances.