How was a URL like http://stackoverflow.com/posts/1807421/edit created in PHP? -


when edit question on stackoverflow.com, redirected url this:

https://stackoverflow.com/posts/1807421/edit

but usually, should

https://stackoverflow.com/posts/1807491/edit.php

or

https://stackoverflow.com/posts/edit.php?id=1807491

how

https://stackoverflow.com/posts/1807421/edit created?

i know stackoverflow.com not created using php, wondering how achieve in php?

with apache , php, might perform 1 of examples using mod_rewrite rule in apache config follows:

rewriteengine on rewriterule ^/posts/(\d+)/edit /posts/edit.php?id=$1 

this looks urls of "clean" form, , rewrites them internally redirected particular php script.

quite rules used route requests common controller script, might instantiate "postscontroller" class , ask handle edit request. common feature of php application frameworks.