FIrst, decide your router source strategy. It can either come from a get query _url
variable, or from the global $_SERVER[REQUEST_URI]
variable.
I usually use the second approach:
in your router service setup
$router = new Router();
$router->setUriSource(Router::URI_SOURCE_SERVER_REQUEST_URI);
nginx:
server {
listen 80;
server_name localhost.dev;
root /var/www/your-project/ng-app;
index index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.html; # <- this will route all 404 pages to your index.html inside the ng-app folder
}
location ~ \.php$ {
root /var/www/your-project/api/public; # <- changes root dir for php files
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}