I have started using the PHP 5.6's built in web server using the following command:
php -S localhost:80
I was using WAMP Server before. And the manual also says that, if you give a router script to the above command, say like:
php -S localhost:80 router.php
We can achieve something like .htaccess
. But I couldn't find a reliable tutorial to how to do the redirection or include. Right now, my .htaccess
file has this contents:
RewriteEngine On
RewriteRule (.*)-(.*)\.htm$ ./?page=$1&sub=$2&%{QUERY_STRING}
RewriteRule ^([^/]*)\.htm$ ./?page=$1&%{QUERY_STRING} [L]
What am I supposed to put in the router.php
in order to achieve the same output that I had in the Apache Web Server? Thanks in Advance.
I've included a bunch of 'helper' functions which will make it easier to write your rewrite rules (borrowed here).