This is a very simple one, kinda works like rewriting. All page path requests will be passed to PHP though $_GET[‘page’]. Not the greatest implementation, but it works, and it works well. Everything else works as you would expect it.
To pass all requests inside /directory to /directory/index.php as ?page=/request
NGINX
site configuration
location /directory {
index index.php;
try_files $uri $uri/ /directory/index.php?page=$uri&$args;
}APACHE
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?page=%{REQUEST_URI}&%{QUERY_STRING} [L]So if I request:
http://domain.tld/directory/2017/january/25?1=2&3=4
NginX will pass it (in the background) to
/directory/index.php?page=/2017/january/25&1=2&3=4
and the $_GET superglobal in index.php will be equivalent to:
array {
'page' => '/2017/january/25',
1 => 2,
3 => 4
}