The theory of knots and links studies the embedding mode of one or several closed curves in three-dimensional Euclidean space. In the electromagnetic field system, all-optical knots or links composed of phase or polarization singularities have been verified both theoretically and experimentally. Recent studies have shown that robust topological all-optical coding can be achieved by using optical knots and links. However, in the current design of optical knots and links based on phase or polarization singularities, the amplitude of light between adjacent singularities is relatively weak. This brings great pressure to the detection of optical knots and links and limits their application. Here, we propose a new optimization method in theory. Compared with the existing design methods, our design method improves the relative intensity distribution of light between adjacent singularities. We have verified the feasibility of our design results in experiments. Our research reduces the detection difficulty of optical knots and links, and has a positive significance for the promotion of the application of optical knots and links.