How to remove ?p= from WordPress short links?

I removed ?p= from wp\_get\_shortlink and it's get the links without ?p= successfully but the problem that this links not working until added ?p= so how can make links working without added ?p=.