Let's consider reddit for example where people create let's say posts. Every post created has its own html page where you can see comments and etc. 

I am interested in how these pages are created, I would assume that when user creates a post, when the post is authorized, its page is automatically created, but I don't have any idea how this is done. So my questions are: how is this exactly done, or am I completely wrong about the whole concept, and if so - what is the best way to do this then(create single html pages for every post authorized in the database) ?