如何根据在Google上搜索的字词对自定义网址编制索引

Sometimes I see on Google links with my terms searched on Google as parameter. For example, if I search "StrangeWord", I can see in results:

example.com/p=StrangeWord

I'm pretty sure it is generated automatically, how to do it? I'm using PHP with Nginx.

It isn't generated automatically. If that page is in the index, it's because there was a crawlable link to that page - whether intentionally done by the webmaster or not - and Google happened to crawl that link.

Links can get generated by users sharing such a page, bookmarking it, or even linking to it from their own sites / social profiles