Friendly URLs on PHP 5.4 built-in server -


I usually use Apache as a web server for my PHP applications. But I find that PHP 5.4 came with a built-in web server.

In the first app I tried to load PHP -S, I saw that the rewrite rules are not enabled or do not work properly.

Does anybody know that there is such a thing in the underlying server?

section of manual:

If a web page is turned on So a PHP file is given on the command line, it is considered as a "router" script, the script runs at the beginning of each HTTP request. If this script returns FALSE, then the requested resource is returned-otherwise , The output of the script is returned in the browser.

Router file

  & lt ;? Php // routing.php if other (include __DIR__ (preg_match ('/. (?? (png | jpg | jpeg | gif) $ /', $ _SERVER ["REQUEST_URI"])) {false return;} '/index.php';}  

and then start the server with:

  php -S localhost: 8888 routing.php  

Credit:

Important note

This web server was designed for application development help. Applications running for purposes or in controlled displays can also be useful for demonstrations It is not intended to be a full-featured web server it should not be used on any public network .


Comments