PHP code example of giftcards / mod-rewrite
1. Go to this page and download the library: Download giftcards/mod-rewrite library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
giftcards / mod-rewrite example snippets
use Giftcards\ModRewrite\RewriterBuilder;
use Giftcards\ModRewriter\Compiler\CompilerBuilder;
use Symfony\Component\HttpFoundation\Request;
$rewriter = RewriterBuilder::create()->build();
$compiler = CompilerBuilder::create()->build();
$request = Request::createFromGlobals();
$file = __DIR__.'/rewrite_rules';
$result = $rewriter->rewrite(
rawurldecode($request->getPathInfo()),
$request,
$compiler->compile(file_get_contents($file))
);