.htaccess - How does PHP create new html pages? -


as many of know when creates stackoverflow question new page generated , visible in various search engines well. wondering how php code created these pages. turns out websites have 1 page, profile.php , loads data mysql database. question follows: if there 1 physical file how can url change , how google list of pages/profiles/question sites stackoverflow or facebook if there 1 actual page?

look @ url page question on:

http://stackoverflow.com/questions/39457314/how-does-php-create-new-html-pages 

there isn't physical file on server's harddrive it. there's 1 master script called "show question page". happen, in general, dynamically generated page:

  1. user clicks or otherwise surfs dynamic page
  2. webserver accepts request, , triggers rewrite on url
  3. url gets changed "friendly" url "ugly" internal one. while stackoverflow isn't written in php, if was, you'd end internally:

    http://stackoverflow.com/showquestion.php?id=39457314 
  4. webserver executes showquestion.php script

  5. code in script necessary work build response page: question text, answers, etc... format html, , send html user.

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -