Website creates URL instead of giving 404 error


If I wanted to make it so my website created a page instead of giving a 404 error, how would I do it? For example, at https://mathim.com/, if I put anything after the , such as https://mathim.com/random-word, it will go to a pre-designed, but functional, page, but not 404.